Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-10-22 08:00:47 +0000
committerEike Stepper2013-10-22 08:00:47 +0000
commit260cb8da5913d9f3ff096d3172f0e7035efe07fa (patch)
tree3bf88cef81b0ce86197782defd8987d3b53c451f
parent739173c1b3a5b64a330cce45aa90f0bd0dbc23db (diff)
parent56f2473071fbb6e3eb2aebfb7eed66b3e09add08 (diff)
downloadcdo-260cb8da5913d9f3ff096d3172f0e7035efe07fa.tar.gz
cdo-260cb8da5913d9f3ff096d3172f0e7035efe07fa.tar.xz
cdo-260cb8da5913d9f3ff096d3172f0e7035efe07fa.zip
Merge branch 'master' of ssh://estepper@git.eclipse.org:29418/cdo/cdo
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/actions/ManualPerformAction.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/ui/ProgressLogDialog.java53
4 files changed, 68 insertions, 62 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/actions/ManualPerformAction.java b/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/actions/ManualPerformAction.java
index a1a581e364..6abd3c1f1a 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/actions/ManualPerformAction.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.editor/src/org/eclipse/emf/cdo/releng/setup/presentation/actions/ManualPerformAction.java
@@ -23,8 +23,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
-import java.io.File;
-
/**
* @author Eike Stepper
*/
@@ -66,10 +64,8 @@ public class ManualPerformAction implements IWorkbenchWindowActionDelegate
// return;
// }
- File logFile = new File(setupTaskPerformer.getInstallDir(), "setup.log");
- IWorkbenchWindow window = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
- final Shell shell = window.getShell();
- ProgressLogDialog.run(shell, logFile, "Setting up IDE", new ProgressLogRunnable()
+ Shell shell = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell();
+ ProgressLogDialog.run(shell, "Setting up IDE", new ProgressLogRunnable()
{
public boolean run(ProgressLog log) throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
index 7a5d8230e1..bb67c78183 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup.product/src/org/eclipse/emf/cdo/releng/setup/product/SetupDialog.java
@@ -643,8 +643,7 @@ public class SetupDialog extends TitleAreaDialog
File folder = new File(installFolder);
folder.mkdirs();
- File logFile = new File(installFolder, "setup.log");
- ProgressLogDialog.run(getShell(), logFile, "Setting up IDE", new ProgressLogRunnable()
+ ProgressLogDialog.run(getShell(), "Setting up IDE", new ProgressLogRunnable()
{
public boolean run(ProgressLog log) throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
index 2294a185e5..af04607453 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
@@ -21,6 +21,8 @@ import org.eclipse.emf.cdo.releng.setup.util.OS;
import org.eclipse.emf.cdo.releng.setup.util.log.ProgressLog;
import org.eclipse.emf.cdo.releng.setup.util.log.ProgressLogRunnable;
+import org.eclipse.net4j.util.io.IOUtil;
+
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -41,7 +43,11 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -81,6 +87,8 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
private transient boolean restartNeeded;
+ private PrintStream logStream;
+
private List<String> logMessageBuffer;
public SetupTaskPerformer(File branchDir)
@@ -115,13 +123,13 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
{
for (String value : logMessageBuffer)
{
- progress.log(value);
+ doLog(value);
}
logMessageBuffer = null;
}
- progress.log(line);
+ doLog(line);
}
else
{
@@ -134,6 +142,24 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
}
}
+ private void doLog(String line)
+ {
+ if (logStream != null)
+ {
+ try
+ {
+ logStream.println("[" + ProgressLogDialog.DATE_TIME.format(new Date()) + "] " + line);
+ logStream.flush();
+ }
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ }
+ }
+
+ progress.log(line);
+ }
+
public void log(IStatus status)
{
log(ProgressLogDialog.toString(status));
@@ -172,9 +198,17 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
{
result.append(string.substring(previous, matcher.start()));
String key = matcher.group(1);
- if (NEEDS_PATH_SEPARATOR_CONVERSION)
+ String suffix = "";
+
+ int prefixIndex = key.indexOf('/');
+ if (prefixIndex != -1)
{
- key = key.replace('/', File.pathSeparatorChar);
+ suffix = key.substring(prefixIndex);
+ key = key.substring(0, prefixIndex);
+ if (NEEDS_PATH_SEPARATOR_CONVERSION)
+ {
+ suffix = suffix.replace('/', File.pathSeparatorChar);
+ }
}
String value = lookup(key);
@@ -188,6 +222,7 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
}
result.append(value);
+ result.append(suffix);
previous = matcher.end();
}
@@ -277,6 +312,15 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
reorder(setupTasks);
perform(setupTasks);
+
+ if (logStream != null)
+ {
+ logStream.println();
+ logStream.println();
+ logStream.println();
+ logStream.println();
+ IOUtil.closeSilent(logStream);
+ }
}
protected String lookup(String key)
@@ -327,6 +371,17 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
put("setup.project.name", projectName);
put("setup.branch.name", branchName);
put("releng.url", RELENG_URL);
+
+ try
+ {
+ File logFile = new File(getBranchDir(), "setup.log");
+ logFile.getParentFile().mkdirs();
+ logStream = new PrintStream(new FileOutputStream(logFile, true));
+ }
+ catch (FileNotFoundException ex)
+ {
+ throw new RuntimeException(ex);
+ }
}
private void reorder(EList<SetupTask> setupTasks)
@@ -372,10 +427,9 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
if (Activator.SETUP_IDE && trigger != Trigger.MANUAL)
{
- File logFile = new File(getInstallDir(), "setup.log");
Shell shell = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell();
- ProgressLogDialog.run(shell, logFile, "Setting up IDE", new ProgressLogRunnable()
+ ProgressLogDialog.run(shell, "Setting up IDE", new ProgressLogRunnable()
{
public boolean run(ProgressLog log) throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/ui/ProgressLogDialog.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/ui/ProgressLogDialog.java
index d6c9487ca2..0cfa85cde3 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/ui/ProgressLogDialog.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/ui/ProgressLogDialog.java
@@ -16,8 +16,6 @@ import org.eclipse.emf.cdo.releng.setup.util.log.ProgressLog;
import org.eclipse.emf.cdo.releng.setup.util.log.ProgressLogProvider;
import org.eclipse.emf.cdo.releng.setup.util.log.ProgressLogRunnable;
-import org.eclipse.net4j.util.io.IOUtil;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -43,9 +41,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.progress.ProgressManager;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
@@ -55,9 +50,9 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
{
public static final String TITLE = "Setup Development Environment";
- private static final SimpleDateFormat TIME = new SimpleDateFormat("HH:mm:ss");
+ public static final SimpleDateFormat DATE_TIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- private static final SimpleDateFormat DATE_TIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private static final SimpleDateFormat TIME = new SimpleDateFormat("HH:mm:ss");
private static final String[] IGNORED_PREFIXES = { "Scanning Git", "Re-indexing", "Calculating Decorations",
"Decorating", "http://", "The user operation is waiting", "Git repository changed", "Refreshing ", "Opening ",
@@ -70,8 +65,6 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
"Preparing to build", "Compiling ", "Analyzing ", "Comparing ", "Checking ", "Build done",
"Processing API deltas..." };
- private PrintStream logStream;
-
private Text text;
private Button okButton;
@@ -82,21 +75,9 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
private String lastLine;
- private ProgressLogDialog(Shell parentShell, File logFile)
+ private ProgressLogDialog(Shell parentShell)
{
super(parentShell);
- if (logFile != null)
- {
- try
- {
- logFile.getParentFile().mkdirs();
- logStream = new PrintStream(new FileOutputStream(logFile, true));
- }
- catch (FileNotFoundException ex)
- {
- throw new RuntimeException(ex);
- }
- }
setHelpAvailable(false);
setShellStyle(SWT.BORDER | SWT.MAX | SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL);
@@ -160,15 +141,6 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
{
SetupTaskPerformer.setProgress(null);
- if (logStream != null)
- {
- logStream.println();
- logStream.println();
- logStream.println();
- logStream.println();
- IOUtil.closeSilent(logStream);
- }
-
return super.close();
}
@@ -218,19 +190,6 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
final String message = line + "\n";
final Date date = new Date();
- if (logStream != null)
- {
- try
- {
- logStream.print("[" + DATE_TIME.format(date) + "] " + message);
- logStream.flush();
- }
- catch (Exception ex)
- {
- Activator.log(ex);
- }
- }
-
asyncExec(new Runnable()
{
public void run()
@@ -255,7 +214,6 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
public void setFinished()
{
Job.getJobManager().setProgressProvider(ProgressManager.getInstance());
-
asyncExec(new Runnable()
{
public void run()
@@ -263,7 +221,6 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
try
{
okButton.setEnabled(true);
- cancelButton.setEnabled(false);
}
catch (Exception ex)
{
@@ -308,12 +265,12 @@ public class ProgressLogDialog extends TitleAreaDialog implements ProgressLog
return false;
}
- public static void run(Shell shell, File logFile, final String jobName, final ProgressLogRunnable runnable)
+ public static void run(Shell shell, final String jobName, final ProgressLogRunnable runnable)
{
try
{
final boolean[] restart = { false };
- final ProgressLogDialog dialog = new ProgressLogDialog(shell, logFile);
+ final ProgressLogDialog dialog = new ProgressLogDialog(shell);
Runnable jobRunnable = new Runnable()
{
public void run()

Back to the top