/**********************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
**********************************************************************/
package org.eclipse.linuxtools.internal.tracing.rcp.ui;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.linuxtools.internal.tracing.rcp.ui.messages.Messages;
+import org.eclipse.linuxtools.internal.tracing.rcp.ui.cli.CliParser;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfOpenTraceHelper;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectRegistry;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
import org.eclipse.ui.IWorkbenchPage;
// "org.eclipse.debug.ui.profileActionSet"
};
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
* Standard constructor
+ *
* @param configurer
- * - the workbench window configurer
+ * - the workbench window configurer
*/
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
super(configurer);
configurer.setShowCoolBar(false);
configurer.setShowStatusLine(true);
configurer.setShowProgressIndicator(true);
- configurer.setTitle(Messages.ApplicationWorkbenchWindowAdvisor_WindowTitle);
}
@Override
public void postWindowCreate() {
super.postWindowOpen();
TracingRcpPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new PerspectiveListener());
- createDefaultProject();
+ IProject defaultProject = createDefaultProject();
hideActionSets();
+ openTraceIfNecessary(defaultProject);
+ }
+
+
+
+ private static void openTraceIfNecessary(IProject project) {
+ String traceToOpen = TracingRcpPlugin.getDefault().getCli().getArgument(CliParser.OPEN_FILE_LOCATION);
+ if (traceToOpen != null) {
+ try {
+ TmfTraceFolder destinationFolder = TmfProjectRegistry.getProject(project, true).getTracesFolder();
+ TmfOpenTraceHelper.openTraceFromPath(destinationFolder, traceToOpen, TracingRcpPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell());
+ } catch (CoreException e) {
+ TracingRcpPlugin.getDefault().logError(e.getMessage());
+ }
+
+ }
}
// ------------------------------------------------------------------------
}
}
- private static void createDefaultProject() {
- TmfProjectRegistry.createProject(Messages.ApplicationWorkbenchWindowAdvisor_DefaultProjectName, null, new NullProgressMonitor());
+ private static IProject createDefaultProject() {
+ return TmfProjectRegistry.createProject(TmfCommonConstants.DEFAULT_TRACE_PROJECT_NAME, null, new NullProgressMonitor());
}
/**
- * A perspective listener implementation
- * @author Bernd Hufmann
+ * A perspective listener implementation
+ *
+ * @author Bernd Hufmann
*/
public class PerspectiveListener implements IPerspectiveListener {
/**
- * Default Constructor
+ * Default Constructor
*/
public PerspectiveListener() {
}