JBoss Tools SVN: r29769 - branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-03-14 17:10:36 -0400 (Mon, 14 Mar 2011)
New Revision: 29769
Added:
branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/DeprecatedEclipseLog.java
Modified:
branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java
Log:
JBIDE-8556 to indigo branch
Added: branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/DeprecatedEclipseLog.java
===================================================================
--- branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/DeprecatedEclipseLog.java (rev 0)
+++ branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/DeprecatedEclipseLog.java 2011-03-14 21:10:36 UTC (rev 29769)
@@ -0,0 +1,677 @@
+package org.jboss.ide.eclipse.as.core.extensions.events;
+
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.security.AccessController;
+import java.util.Calendar;
+import java.util.Date;
+import org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo;
+import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
+import org.eclipse.osgi.framework.log.FrameworkLog;
+import org.eclipse.osgi.framework.log.FrameworkLogEntry;
+import org.eclipse.osgi.framework.util.SecureAction;
+import org.osgi.framework.*;
+
+public class DeprecatedEclipseLog implements FrameworkLog {
+ private static final String PASSWORD = "-password"; //$NON-NLS-1$
+ /** The session tag */
+ protected static final String SESSION = "!SESSION"; //$NON-NLS-1$
+ /** The entry tag */
+ protected static final String ENTRY = "!ENTRY"; //$NON-NLS-1$
+ /** The sub-entry tag */
+ protected static final String SUBENTRY = "!SUBENTRY"; //$NON-NLS-1$
+ /** The message tag */
+ protected static final String MESSAGE = "!MESSAGE"; //$NON-NLS-1$
+ /** The stacktrace tag */
+ protected static final String STACK = "!STACK"; //$NON-NLS-1$
+
+ /** The line separator used in the log output */
+ protected static final String LINE_SEPARATOR;
+ /** The tab character used in the log output */
+ protected static final String TAB_STRING = "\t"; //$NON-NLS-1$
+
+ //Constants for rotating log file
+ /** The default size a log file can grow before it is rotated */
+ public static final int DEFAULT_LOG_SIZE = 1000;
+ /** The default number of backup log files */
+ public static final int DEFAULT_LOG_FILES = 10;
+ /** The minimum size limit for log rotation */
+ public static final int LOG_SIZE_MIN = 10;
+
+ /** The system property used to specify the log level */
+ public static final String PROP_LOG_LEVEL = "eclipse.log.level"; //$NON-NLS-1$
+ /** The system property used to specify size a log file can grow before it is rotated */
+ public static final String PROP_LOG_SIZE_MAX = "eclipse.log.size.max"; //$NON-NLS-1$
+ /** The system property used to specify the maximim number of backup log files to use */
+ public static final String PROP_LOG_FILE_MAX = "eclipse.log.backup.max"; //$NON-NLS-1$
+ /** The extension used for log files */
+ public static final String LOG_EXT = ".log"; //$NON-NLS-1$
+ /** The extension markup to use for backup log files*/
+ public static final String BACKUP_MARK = ".bak_"; //$NON-NLS-1$
+
+ static {
+ String s = System.getProperty("line.separator"); //$NON-NLS-1$
+ LINE_SEPARATOR = s == null ? "\n" : s; //$NON-NLS-1$
+ }
+ private static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction());
+
+ /** Indicates if the console messages should be printed to the console (System.out) */
+ protected boolean consoleLog = false;
+ /** Indicates if the next log message is part of a new session */
+ protected boolean newSession = true;
+ /**
+ * The File object to store messages. This value may be null.
+ */
+ protected File outFile;
+
+ /**
+ * The Writer to log messages to.
+ */
+ protected Writer writer;
+
+ int maxLogSize = DEFAULT_LOG_SIZE; // The value is in KB.
+ int maxLogFiles = DEFAULT_LOG_FILES;
+ int backupIdx = 0;
+
+ private int logLevel = FrameworkLogEntry.OK;
+
+ /**
+ * Constructs an EclipseLog which uses the specified File to log messages to
+ * @param outFile a file to log messages to
+ */
+ public DeprecatedEclipseLog(File outFile) {
+ this.outFile = outFile;
+ this.writer = null;
+ readLogProperties();
+ }
+
+ /**
+ * Constructs an EclipseLog which uses the specified Writer to log messages to
+ * @param writer a writer to log messages to
+ */
+ public DeprecatedEclipseLog(Writer writer) {
+ if (writer == null)
+ // log to System.err by default
+ this.writer = logForStream(System.err);
+ else
+ this.writer = writer;
+ }
+
+ /**
+ * Constructs an EclipseLog which uses System.err to write log messages to
+ *
+ */
+ public DeprecatedEclipseLog() {
+ this((Writer) null);
+ }
+
+ private Throwable getRoot(Throwable t) {
+ Throwable root = null;
+ if (t instanceof BundleException)
+ root = ((BundleException) t).getNestedException();
+ if (t instanceof InvocationTargetException)
+ root = ((InvocationTargetException) t).getTargetException();
+ // skip inner InvocationTargetExceptions and BundleExceptions
+ if (root instanceof InvocationTargetException || root instanceof BundleException) {
+ Throwable deeplyNested = getRoot(root);
+ if (deeplyNested != null)
+ // if we have something more specific, use it, otherwise keep what we have
+ root = deeplyNested;
+ }
+ return root;
+ }
+
+ /**
+ * Helper method for writing out argument arrays.
+ * @param header the header
+ * @param args the list of arguments
+ */
+ protected void writeArgs(String header, String[] args) throws IOException {
+ if (args == null || args.length == 0)
+ return;
+ write(header);
+ for (int i = 0; i < args.length; i++) {
+ //mask out the password argument for security
+ if (i > 0 && PASSWORD.equals(args[i - 1]))
+ write(" (omitted)"); //$NON-NLS-1$
+ else
+ write(" " + args[i]); //$NON-NLS-1$
+ }
+ writeln();
+ }
+
+ /**
+ * Returns the session timestamp. This is the time the platform was started
+ * @return the session timestamp
+ */
+ protected String getSessionTimestamp() {
+ // Main should have set the session start-up timestamp so return that.
+ // Return the "now" time if not available.
+ String ts = FrameworkProperties.getProperty("eclipse.startTime"); //$NON-NLS-1$
+ if (ts != null) {
+ try {
+ return getDate(new Date(Long.parseLong(ts)));
+ } catch (NumberFormatException e) {
+ // fall through and use the timestamp from right now
+ }
+ }
+ return getDate(new Date());
+ }
+
+ /**
+ * Writes the session
+ * @throws IOException if an error occurs writing to the log
+ */
+ protected void writeSession() throws IOException {
+ write(SESSION);
+ writeSpace();
+ String date = getSessionTimestamp();
+ write(date);
+ writeSpace();
+ for (int i = SESSION.length() + date.length(); i < 78; i++) {
+ write("-"); //$NON-NLS-1$
+ }
+ writeln();
+ // Write out certain values found in System.getProperties()
+ try {
+ String key = "eclipse.buildId"; //$NON-NLS-1$
+ String value = FrameworkProperties.getProperty(key, "unknown"); //$NON-NLS-1$
+ writeln(key + "=" + value); //$NON-NLS-1$
+
+ key = "java.fullversion"; //$NON-NLS-1$
+ value = System.getProperty(key);
+ if (value == null) {
+ key = "java.version"; //$NON-NLS-1$
+ value = System.getProperty(key);
+ writeln(key + "=" + value); //$NON-NLS-1$
+ key = "java.vendor"; //$NON-NLS-1$
+ value = System.getProperty(key);
+ writeln(key + "=" + value); //$NON-NLS-1$
+ } else {
+ writeln(key + "=" + value); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ // If we're not allowed to get the values of these properties
+ // then just skip over them.
+ }
+ // The Bootloader has some information that we might be interested in.
+ write("BootLoader constants: OS=" + EclipseEnvironmentInfo.getDefault().getOS()); //$NON-NLS-1$
+ write(", ARCH=" + EclipseEnvironmentInfo.getDefault().getOSArch()); //$NON-NLS-1$
+ write(", WS=" + EclipseEnvironmentInfo.getDefault().getWS()); //$NON-NLS-1$
+ writeln(", NL=" + EclipseEnvironmentInfo.getDefault().getNL()); //$NON-NLS-1$
+ // Add the command-line arguments used to invoke the platform
+ // XXX: this includes runtime-private arguments - should we do that?
+ writeArgs("Framework arguments: ", EclipseEnvironmentInfo.getDefault().getNonFrameworkArgs()); //$NON-NLS-1$
+ writeArgs("Command-line arguments: ", EclipseEnvironmentInfo.getDefault().getCommandLineArgs()); //$NON-NLS-1$
+ }
+
+ public void close() {
+ try {
+ if (writer != null) {
+ Writer tmpWriter = writer;
+ writer = null;
+ tmpWriter.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * If a File is used to log messages to then the File opened and a Writer is created
+ * to log messages to.
+ */
+ protected void openFile() {
+ if (writer == null) {
+ if (outFile != null) {
+ try {
+ writer = logForStream(secureAction.getFileOutputStream(outFile, true));
+ } catch (IOException e) {
+ writer = logForStream(System.err);
+ }
+ } else {
+ writer = logForStream(System.err);
+ }
+ }
+ }
+
+ /**
+ * If a File is used to log messages to then the writer is closed.
+ */
+ protected void closeFile() {
+ if (outFile != null) {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ // we cannot log here; just print the stacktrace.
+ e.printStackTrace();
+ }
+ writer = null;
+ }
+ }
+ }
+
+ public void log(FrameworkEvent frameworkEvent) {
+ Bundle b = frameworkEvent.getBundle();
+ Throwable t = frameworkEvent.getThrowable();
+ String entry = b.getSymbolicName() == null ? b.getLocation() : b.getSymbolicName();
+ int severity;
+ switch (frameworkEvent.getType()) {
+ case FrameworkEvent.INFO :
+ severity = FrameworkLogEntry.INFO;
+ break;
+ case FrameworkEvent.ERROR :
+ severity = FrameworkLogEntry.ERROR;
+ break;
+ case FrameworkEvent.WARNING :
+ severity = FrameworkLogEntry.WARNING;
+ break;
+ default :
+ severity = FrameworkLogEntry.OK;
+ }
+ FrameworkLogEntry logEntry = new FrameworkLogEntry(entry, severity, 0, "", 0, t, null); //$NON-NLS-1$
+ log(logEntry);
+ }
+
+ public synchronized void log(FrameworkLogEntry logEntry) {
+ if (logEntry == null)
+ return;
+ if (!isLoggable(logEntry))
+ return;
+ try {
+ checkLogFileSize();
+ openFile();
+ if (newSession) {
+ writeSession();
+ newSession = false;
+ }
+ writeLog(0, logEntry);
+ writer.flush();
+ } catch (Exception e) {
+ // any exceptions during logging should be caught
+ System.err.println("An exception occurred while writing to the platform log:");//$NON-NLS-1$
+ e.printStackTrace(System.err);
+ System.err.println("Logging to the console instead.");//$NON-NLS-1$
+ //we failed to write, so dump log entry to console instead
+ try {
+ writer = logForStream(System.err);
+ writeLog(0, logEntry);
+ writer.flush();
+ } catch (Exception e2) {
+ System.err.println("An exception occurred while logging to the console:");//$NON-NLS-1$
+ e2.printStackTrace(System.err);
+ }
+ } finally {
+ closeFile();
+ }
+ }
+
+ public synchronized void setWriter(Writer newWriter, boolean append) {
+ setOutput(null, newWriter, append);
+ }
+ public static final String PROP_LOGFILE = "osgi.logfile"; //$NON-NLS-1$
+
+ /**
+ * @throws IOException
+ */
+ public synchronized void setFile(File newFile, boolean append) throws IOException {
+ if (newFile != null && !newFile.equals(this.outFile)) {
+ // If it's a new file, then reset.
+ readLogProperties();
+ backupIdx = 0;
+ }
+ setOutput(newFile, null, append);
+ FrameworkProperties.setProperty(PROP_LOGFILE, newFile == null ? "" : newFile.getAbsolutePath()); //$NON-NLS-1$
+ }
+
+ public synchronized File getFile() {
+ return outFile;
+ }
+
+ public void setConsoleLog(boolean consoleLog) {
+ this.consoleLog = consoleLog;
+ }
+
+ private void setOutput(File newOutFile, Writer newWriter, boolean append) {
+ if (newOutFile == null || !newOutFile.equals(this.outFile)) {
+ if (this.writer != null) {
+ try {
+ this.writer.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ this.writer = null;
+ }
+ // Append old outFile to newWriter. We only attempt to do this
+ // if the current Writer is backed by a File and this is not
+ // a new session.
+ File oldOutFile = this.outFile;
+ this.outFile = newOutFile;
+ this.writer = newWriter;
+ boolean copyFailed = false;
+ if (append && oldOutFile != null && oldOutFile.isFile()) {
+ Reader fileIn = null;
+ try {
+ openFile();
+ fileIn = new InputStreamReader(secureAction.getFileInputStream(oldOutFile), "UTF-8"); //$NON-NLS-1$
+ copyReader(fileIn, this.writer);
+ } catch (IOException e) {
+ copyFailed = true;
+ e.printStackTrace();
+ } finally {
+ if (fileIn != null) {
+ try {
+ fileIn.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // delete the old file if copying didn't fail
+ if (!copyFailed)
+ oldOutFile.delete();
+ }
+ closeFile();
+ }
+ }
+ }
+ }
+
+ private void copyReader(Reader reader, Writer aWriter) throws IOException {
+ char buffer[] = new char[1024];
+ int count;
+ while ((count = reader.read(buffer, 0, buffer.length)) > 0) {
+ aWriter.write(buffer, 0, count);
+ }
+ }
+
+ /**
+ * Returns a date string using the correct format for the log.
+ * @param date the Date to format
+ * @return a date string.
+ */
+ protected String getDate(Date date) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ StringBuffer sb = new StringBuffer();
+ appendPaddedInt(c.get(Calendar.YEAR), 4, sb).append('-');
+ appendPaddedInt(c.get(Calendar.MONTH) + 1, 2, sb).append('-');
+ appendPaddedInt(c.get(Calendar.DAY_OF_MONTH), 2, sb).append(' ');
+ appendPaddedInt(c.get(Calendar.HOUR_OF_DAY), 2, sb).append(':');
+ appendPaddedInt(c.get(Calendar.MINUTE), 2, sb).append(':');
+ appendPaddedInt(c.get(Calendar.SECOND), 2, sb).append('.');
+ appendPaddedInt(c.get(Calendar.MILLISECOND), 3, sb);
+ return sb.toString();
+ }
+
+ private StringBuffer appendPaddedInt(int value, int pad, StringBuffer buffer) {
+ pad = pad - 1;
+ if (pad == 0)
+ return buffer.append(Integer.toString(value));
+ int padding = (int) Math.pow(10, pad);
+ if (value >= padding)
+ return buffer.append(Integer.toString(value));
+ while (padding > value && padding > 1) {
+ buffer.append('0');
+ padding = padding / 10;
+ }
+ buffer.append(value);
+ return buffer;
+ }
+
+ /**
+ * Returns a stacktrace string using the correct format for the log
+ * @param t the Throwable to get the stacktrace for
+ * @return a stacktrace string
+ */
+ protected String getStackTrace(Throwable t) {
+ if (t == null)
+ return null;
+
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ t.printStackTrace(pw);
+ // ensure the root exception is fully logged
+ Throwable root = getRoot(t);
+ if (root != null) {
+ pw.println("Root exception:"); //$NON-NLS-1$
+ root.printStackTrace(pw);
+ }
+ return sw.toString();
+ }
+
+ /**
+ * Returns a Writer for the given OutputStream
+ * @param output an OutputStream to use for the Writer
+ * @return a Writer for the given OutputStream
+ */
+ protected Writer logForStream(OutputStream output) {
+ try {
+ return new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ return new BufferedWriter(new OutputStreamWriter(output));
+ }
+ }
+
+ /**
+ * Writes the log entry to the log using the specified depth. A depth value of 0
+ * idicates that the log entry is the root entry. Any value greater than 0 indicates
+ * a sub-entry.
+ * @param depth the depth of th entry
+ * @param entry the entry to log
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeLog(int depth, FrameworkLogEntry entry) throws IOException {
+ writeEntry(depth, entry);
+ writeMessage(entry);
+ writeStack(entry);
+
+ FrameworkLogEntry[] children = entry.getChildren();
+ if (children != null) {
+ for (int i = 0; i < children.length; i++) {
+ writeLog(depth + 1, children[i]);
+ }
+ }
+ }
+
+ /**
+ * Writes the ENTRY or SUBENTRY header for an entry. A depth value of 0
+ * indicates that the log entry is the root entry. Any value greater than 0 indicates
+ * a sub-entry.
+ * @param depth the depth of th entry
+ * @param entry the entry to write the header for
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeEntry(int depth, FrameworkLogEntry entry) throws IOException {
+ if (depth == 0) {
+ writeln(); // write a blank line before all !ENTRY tags bug #64406
+ write(ENTRY);
+ } else {
+ write(SUBENTRY);
+ writeSpace();
+ write(Integer.toString(depth));
+ }
+ writeSpace();
+ write(entry.getEntry());
+ writeSpace();
+ write(Integer.toString(entry.getSeverity()));
+ writeSpace();
+ write(Integer.toString(entry.getBundleCode()));
+ writeSpace();
+ write(getDate(new Date()));
+ writeln();
+ }
+
+ /**
+ * Writes the MESSAGE header to the log for the given entry.
+ * @param entry the entry to write the message for
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeMessage(FrameworkLogEntry entry) throws IOException {
+ write(MESSAGE);
+ writeSpace();
+ writeln(entry.getMessage());
+ }
+
+ /**
+ * Writes the STACK header to the log for the given entry.
+ * @param entry the entry to write the stacktrace for
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeStack(FrameworkLogEntry entry) throws IOException {
+ Throwable t = entry.getThrowable();
+ if (t != null) {
+ String stack = getStackTrace(t);
+ write(STACK);
+ writeSpace();
+ write(Integer.toString(entry.getStackCode()));
+ writeln();
+ write(stack);
+ }
+ }
+
+ /**
+ * Writes the given message to the log.
+ * @param message the message
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void write(String message) throws IOException {
+ if (message != null) {
+ writer.write(message);
+ if (consoleLog)
+ System.out.print(message);
+ }
+ }
+
+ /**
+ * Writes the given message to the log and a newline.
+ * @param s the message
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeln(String s) throws IOException {
+ write(s);
+ writeln();
+ }
+
+ /**
+ * Writes a newline log.
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeln() throws IOException {
+ write(LINE_SEPARATOR);
+ }
+
+ /**
+ * Writes a space to the log.
+ * @throws IOException if any error occurs writing to the log
+ */
+ protected void writeSpace() throws IOException {
+ write(" "); //$NON-NLS-1$
+ }
+
+ /**
+ * Checks the log file size. If the log file size reaches the limit then the log
+ * is rotated
+ * @return false if an error occured trying to rotate the log
+ */
+ protected boolean checkLogFileSize() {
+ if (maxLogSize == 0)
+ return true; // no size limitation.
+
+ boolean isBackupOK = true;
+ if (outFile != null) {
+ if ((secureAction.length(outFile) >> 10) > maxLogSize) { // Use KB as file size unit.
+ String logFilename = outFile.getAbsolutePath();
+
+ // Delete old backup file that will be replaced.
+ String backupFilename = ""; //$NON-NLS-1$
+ if (logFilename.toLowerCase().endsWith(LOG_EXT)) {
+ backupFilename = logFilename.substring(0, logFilename.length() - LOG_EXT.length()) + BACKUP_MARK + backupIdx + LOG_EXT;
+ } else {
+ backupFilename = logFilename + BACKUP_MARK + backupIdx;
+ }
+ File backupFile = new File(backupFilename);
+ if (backupFile.exists()) {
+ if (!backupFile.delete()) {
+ System.err.println("Error when trying to delete old log file: " + backupFile.getName());//$NON-NLS-1$
+ if (backupFile.renameTo(new File(backupFile.getAbsolutePath() + System.currentTimeMillis()))) {
+ System.err.println("So we rename it to filename: " + backupFile.getName()); //$NON-NLS-1$
+ } else {
+ System.err.println("And we also cannot rename it!"); //$NON-NLS-1$
+ isBackupOK = false;
+ }
+ }
+ }
+
+ // Rename current log file to backup one.
+ boolean isRenameOK = outFile.renameTo(backupFile);
+ if (!isRenameOK) {
+ System.err.println("Error when trying to rename log file to backup one."); //$NON-NLS-1$
+ isBackupOK = false;
+ }
+ File newFile = new File(logFilename);
+ setOutput(newFile, null, false);
+
+ // Write a new SESSION header to new log file.
+ openFile();
+ try {
+ writeSession();
+ writeln();
+ writeln("This is a continuation of log file " + backupFile.getAbsolutePath());//$NON-NLS-1$
+ writeln("Created Time: " + getDate(new Date(System.currentTimeMillis()))); //$NON-NLS-1$
+ writer.flush();
+ } catch (IOException ioe) {
+ ioe.printStackTrace(System.err);
+ }
+ closeFile();
+ backupIdx = (++backupIdx) % maxLogFiles;
+ }
+ }
+ return isBackupOK;
+ }
+
+ /**
+ * Reads the PROP_LOG_SIZE_MAX and PROP_LOG_FILE_MAX properties.
+ */
+ protected void readLogProperties() {
+ String newMaxLogSize = secureAction.getProperty(PROP_LOG_SIZE_MAX);
+ if (newMaxLogSize != null) {
+ maxLogSize = Integer.parseInt(newMaxLogSize);
+ if (maxLogSize != 0 && maxLogSize < LOG_SIZE_MIN) {
+ // If the value is '0', then it means no size limitation.
+ // Also, make sure no inappropriate(too small) assigned value.
+ maxLogSize = LOG_SIZE_MIN;
+ }
+ }
+
+ String newMaxLogFiles = secureAction.getProperty(PROP_LOG_FILE_MAX);
+ if (newMaxLogFiles != null) {
+ maxLogFiles = Integer.parseInt(newMaxLogFiles);
+ if (maxLogFiles < 1) {
+ // Make sure no invalid assigned value. (at least >= 1)
+ maxLogFiles = DEFAULT_LOG_FILES;
+ }
+ }
+
+ String newLogLevel = secureAction.getProperty(PROP_LOG_LEVEL);
+ if (newLogLevel != null) {
+ if (newLogLevel.equals("ERROR")) //$NON-NLS-1$
+ logLevel = FrameworkLogEntry.ERROR;
+ else if (newLogLevel.equals("WARNING")) //$NON-NLS-1$
+ logLevel = FrameworkLogEntry.ERROR | FrameworkLogEntry.WARNING;
+ else if (newLogLevel.equals("INFO")) //$NON-NLS-1$
+ logLevel = FrameworkLogEntry.INFO | FrameworkLogEntry.ERROR | FrameworkLogEntry.WARNING | FrameworkLogEntry.CANCEL;
+ else
+ logLevel = FrameworkLogEntry.OK; // OK (0) means log everything
+ }
+ }
+
+ /**
+ * Determines if the log entry should be logged based on log level.
+ */
+ private boolean isLoggable(FrameworkLogEntry entry) {
+ if (logLevel == 0)
+ return true;
+ return (entry.getSeverity() & logLevel) != 0;
+ }
+}
Modified: branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java
===================================================================
--- branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java 2011-03-14 20:56:49 UTC (rev 29768)
+++ branches/3.3.indigo/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java 2011-03-14 21:10:36 UTC (rev 29769)
@@ -15,10 +15,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.adaptor.EclipseLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-public class ServerLog extends EclipseLog {
+public class ServerLog extends DeprecatedEclipseLog {
public ServerLog(File file) {
super(file);
}
13 years, 8 months
JBoss Tools SVN: r29768 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-03-14 16:56:49 -0400 (Mon, 14 Mar 2011)
New Revision: 29768
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ProcessContextMenuProvider.java
Log:
https://issues.jboss.org/browse/JBIDE-8043
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ProcessContextMenuProvider.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ProcessContextMenuProvider.java 2011-03-14 19:45:06 UTC (rev 29767)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ProcessContextMenuProvider.java 2011-03-14 20:56:49 UTC (rev 29768)
@@ -43,6 +43,7 @@
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -157,12 +158,21 @@
// TODO: need to be more selective here! Only add actions that make sense for this
// context..
for (IAction anAction : bpelEditor.getAppendNewActions()) {
- if (anAction != null && anAction.isEnabled()) {
- addMenu.add(anAction);
+ if (anAction != null) {
+ // https://issues.jboss.org/browse/JBIDE-8043
+ // update the action's current selection
+ if (anAction instanceof SelectionAction)
+ ((SelectionAction)anAction).update();
+ if (anAction.isEnabled())
+ addMenu.add(anAction);
}
}
for (IAction anAction : bpelEditor.getInsertNewActions()) {
- if (anAction != null && anAction.isEnabled()) {
+ if (anAction != null) {
+ // https://issues.jboss.org/browse/JBIDE-8043
+ if (anAction instanceof SelectionAction)
+ ((SelectionAction)anAction).update();
+ if (anAction.isEnabled())
insertMenu.add(anAction);
}
}
13 years, 8 months
JBoss Tools SVN: r29767 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-03-14 15:45:06 -0400 (Mon, 14 Mar 2011)
New Revision: 29767
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java
Log:
https://issues.jboss.org/browse/JBIDE-8075
Create <process>Artifacts.wsdl file if not exist and add to process imports
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java 2011-03-14 18:46:14 UTC (rev 29766)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java 2011-03-14 19:45:06 UTC (rev 29767)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.bpel.ui.util;
+import java.io.IOException;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -23,12 +24,13 @@
import org.eclipse.bpel.common.ui.editmodel.ResourceInfo;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.ui.IBPELUIConstants;
+import org.eclipse.bpel.ui.commands.AddImportCommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
-
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.WSDLFactory;
@@ -97,7 +99,7 @@
if (artifactsFile.exists()) {
artifactsResourceInfo = bpelEditModel.getResourceInfo(artifactsFile);
} else {
- Resource artifactsResource = bpelEditModel.getResourceSet().createResource(
+ final Resource artifactsResource = bpelEditModel.getResourceSet().createResource(
URI.createPlatformResourceURI(artifactsFile.getFullPath().toString()));
// create an empty definition too.
Definition artifactsDefn = WSDLFactory.eINSTANCE.createDefinition();
@@ -105,8 +107,9 @@
// set the target namespace based on the target namespace of the process.
EList bpelContents = getPrimaryResourceInfo().getResource().getContents();
+ Process process = null;
if (!bpelContents.isEmpty() && bpelContents.get(0) instanceof Process) {
- Process process = (Process)bpelContents.get(0);
+ process = (Process)bpelContents.get(0);
// TODO: is this correct? can we make a helper to share this with the wizard?
artifactsDefn.setTargetNamespace(process.getTargetNamespace()+"Artifacts"); //$NON-NLS-1$
artifactsDefn.setQName(new QName(artifactsDefn.getTargetNamespace(),
@@ -114,6 +117,26 @@
}
artifactsResource.getContents().add(artifactsDefn);
artifactsResourceInfo = bpelEditModel.getResourceInfo(artifactsFile);
+
+ // https://issues.jboss.org/browse/JBIDE-8075
+ // add the import if not already being imported by this process
+ AddImportCommand cmd = new AddImportCommand(process, artifactsDefn, artifactsResourceInfo);
+
+ if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
+ getCommandStack().execute(cmd);
+ }
+ artifactsResource.setModified(true);
+
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ try {
+ artifactsResource.save(artifactsResourceInfo.getLoadOptions());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ });
}
}
13 years, 8 months
JBoss Tools SVN: r29766 - trunk/birt/plugins/org.jboss.tools.birt.core/resources.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-03-14 14:46:14 -0400 (Mon, 14 Mar 2011)
New Revision: 29766
Modified:
trunk/birt/plugins/org.jboss.tools.birt.core/resources/jboss-birt-servlet.jar
Log:
JBIDE-8534 BIRT viewer should respect the locale attribute in an xhtml embedded report
Modified: trunk/birt/plugins/org.jboss.tools.birt.core/resources/jboss-birt-servlet.jar
===================================================================
(Binary files differ)
13 years, 8 months
JBoss Tools SVN: r29765 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-03-14 14:44:25 -0400 (Mon, 14 Mar 2011)
New Revision: 29765
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
Log:
JBIDE-8271
Help text for CDI filed conent assist proposal contains unnecessary text with weird symbols in header and doesn't contains any text in case of missing javadoc
Header containing getter/setter methods name is removed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-03-14 17:27:37 UTC (rev 29764)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-03-14 18:44:25 UTC (rev 29765)
@@ -77,7 +77,7 @@
IJavaElement element= null;
if (nResults > 1) {
- for (int i= 0; i < elements.length; i++) {
+/* for (int i= 0; i < elements.length; i++) {
if (elements[i] == null) continue;
if (elements[i] instanceof IMember ||
elements[i].getElementType() == IJavaElement.LOCAL_VARIABLE ||
@@ -87,14 +87,15 @@
}
buffer.append("<br/>"); //$NON-NLS-1$
}
-
+*/
for (int i=0; i < elements.length; i++) {
if (elements[i] == null) continue;
if (elements[i] instanceof IMember ||
elements[i].getElementType() == IJavaElement.LOCAL_VARIABLE ||
elements[i].getElementType() == IJavaElement.TYPE_PARAMETER) {
+ buffer.append('\uE467').append(' ');
+ addFullInfo(buffer, elements[i]);
buffer.append("<br/>"); //$NON-NLS-1$
- addFullInfo(buffer, elements[i]);
hasContents = true;
}
}
13 years, 8 months
JBoss Tools SVN: r29764 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-14 13:27:37 -0400 (Mon, 14 Mar 2011)
New Revision: 29764
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
Log:
[JBIDE-8295] corrected bad preference key (confirmation dialog did not store its value to the key that was indicated as parameter)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java 2011-03-14 16:47:25 UTC (rev 29763)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java 2011-03-14 17:27:37 UTC (rev 29764)
@@ -27,7 +27,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.deltacloud.ui.Activator;
-import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
import org.jboss.tools.deltacloud.ui.preferences.StringsPreferenceValue;
import org.osgi.service.prefs.Preferences;
@@ -128,7 +127,7 @@
// If warning turned off by user, set the preference for future
// usage
if (toggleState) {
- prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, true);
+ prefs.putBoolean(preferencesKey, true);
}
}
return confirmed;
13 years, 8 months
JBoss Tools SVN: r29763 - trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2011-03-14 12:47:25 -0400 (Mon, 14 Mar 2011)
New Revision: 29763
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/
Log:
Folder has been marked for ignoring
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src
___________________________________________________________________
Added: svn:ignore
+ target
13 years, 8 months
JBoss Tools SVN: r29762 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-03-14 12:24:05 -0400 (Mon, 14 Mar 2011)
New Revision: 29762
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
Log:
JBIDE-8575
Code completion for bean properties doesn't work.
Issue is fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-03-14 15:49:10 UTC (rev 29761)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-03-14 16:24:05 UTC (rev 29762)
@@ -239,24 +239,26 @@
resolvedVariables = resolveVariables(file, expr, bundles, true, returnEqualedVariablesOnly);
Set<TextProposal> proposals = new TreeSet<TextProposal>(TextProposal.KB_PROPOSAL_ORDER);
- ELSegmentImpl segment = new MessagePropertyELSegmentImpl();
- segment.setToken(left.getFirstToken());
- processMessageBundleSegment(expr, (MessagePropertyELSegmentImpl)segment, resolvedVariables);
-
- segment.setResolved(false);
- resolution.addSegment(segment);
-
- for (Variable var : resolvedVariables) {
- String varName = var.getName();
- if(varName.startsWith(operand.getText())) {
- TextProposal proposal = new TextProposal();
- proposal.setReplacementString(varName.substring(operand.getLength()));
- setImage(proposal);
- proposals.add(proposal);
+ if (left != null) {
+ ELSegmentImpl segment = new MessagePropertyELSegmentImpl();
+ segment.setToken(left.getFirstToken());
+ processMessageBundleSegment(expr, (MessagePropertyELSegmentImpl)segment, resolvedVariables);
+
+ segment.setResolved(false);
+ resolution.addSegment(segment);
+
+ for (Variable var : resolvedVariables) {
+ String varName = var.getName();
+ if(varName.startsWith(operand.getText())) {
+ TextProposal proposal = new TextProposal();
+ proposal.setReplacementString(varName.substring(operand.getLength()));
+ setImage(proposal);
+ proposals.add(proposal);
+ }
}
+ resolution.setProposals(proposals);
+ segment.setResolved(!proposals.isEmpty());
}
- resolution.setProposals(proposals);
- segment.setResolved(!proposals.isEmpty());
return resolution;
}
13 years, 8 months
JBoss Tools SVN: r29761 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/views/cloudelements and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-14 11:49:10 -0400 (Mon, 14 Mar 2011)
New Revision: 29761
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
Log:
[JBIDE-7862] setting all items again so that the combo shrinks to the space needed to display the largest cloud name
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-14 13:41:40 UTC (rev 29760)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-14 15:49:10 UTC (rev 29761)
@@ -1,6 +1,8 @@
2011-03-14 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
- * src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java (updateCloudSelector):
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
+ (updateCloudSelector) (.run):
+ [JBIDE-7862] setting all items again so that the combo shrinks to the space needed to display the largest cloud name
* src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java (propertyChange):
[JBIDE-8584] ensured updates to widgets happens in display thread
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14 13:41:40 UTC (rev 29760)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14 15:49:10 UTC (rev 29761)
@@ -13,6 +13,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
@@ -371,13 +372,24 @@
if (index >= 0) {
int selectionIndex = currentCloudSelector.getSelectionIndex();
currentCloudSelector.removeModifyListener(currentCloudModifyListener);
- currentCloudSelector.setItem(index, cloud.getName());
+ /*
+ * @see [JBIDE-7862]
+ * setting all items seems necessary so that the combo uses the space needed to display the largest cloud name.
+ * If you just replace the item that was renamed, the combo will not shrink (it would only get larger if needed).
+ */
+ currentCloudSelector.setItems(getSelectorItems(cloud, index));
currentCloudSelector.select(selectionIndex);
currentCloudSelector.addModifyListener(currentCloudModifyListener);
}
container.layout(true, true);
}
+
+ private String[] getSelectorItems(final DeltaCloud cloud, final int index) {
+ List<String> names = new ArrayList<String>(Arrays.asList(currentCloudSelector.getItems()));
+ names.set(index, cloud.getName());
+ return names.toArray(new String[names.size()]);
+ }
});
}
13 years, 8 months
JBoss Tools SVN: r29760 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views: cloudelements and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-14 09:41:40 -0400 (Mon, 14 Mar 2011)
New Revision: 29760
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
Log:
[JBIDE-8584] ensured updates to widgets happens in display thread
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java 2011-03-14 13:38:01 UTC (rev 29759)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java 2011-03-14 13:41:40 UTC (rev 29760)
@@ -14,6 +14,7 @@
import java.beans.PropertyChangeListener;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.views.properties.IPropertySource;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.ui.views.cloud.property.CloudPropertySource;
@@ -59,6 +60,12 @@
@Override
public void propertyChange(PropertyChangeEvent event) {
- viewer.update(this, new String[] { DeltaCloud.PROP_NAME });
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.update(CloudItem.this, new String[] { DeltaCloud.PROP_NAME });
+ }
+ });
}
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14 13:38:01 UTC (rev 29759)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14 13:41:40 UTC (rev 29760)
@@ -360,17 +360,24 @@
}
}
- private void updateCloudSelector(DeltaCloud cloud) {
+ private void updateCloudSelector(final DeltaCloud cloud) {
DeltaCloud[] clouds = getClouds();
- int index = getCloudIndex(cloud, clouds);
- if (index >= 0) {
- int selectionIndex = currentCloudSelector.getSelectionIndex();
- currentCloudSelector.removeModifyListener(currentCloudModifyListener);
- currentCloudSelector.setItem(index, cloud.getName());
- currentCloudSelector.select(selectionIndex);
- currentCloudSelector.addModifyListener(currentCloudModifyListener);
- }
- container.layout(true, true);
+ final int index = getCloudIndex(cloud, clouds);
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (index >= 0) {
+ int selectionIndex = currentCloudSelector.getSelectionIndex();
+ currentCloudSelector.removeModifyListener(currentCloudModifyListener);
+ currentCloudSelector.setItem(index, cloud.getName());
+ currentCloudSelector.select(selectionIndex);
+ currentCloudSelector.addModifyListener(currentCloudModifyListener);
+ }
+ container.layout(true, true);
+
+ }
+ });
}
public void cloudsChanged(int type, DeltaCloud cloud) {
13 years, 8 months