mirror of https://github.com/mchr3k/org.intrace
Upgrade appengine jars, complete intrace launch tab
This commit is contained in:
parent
73d48fd38b
commit
caefe3579a
|
|
@ -1,4 +1,6 @@
|
|||
#Sun Nov 13 21:28:21 GMT 2011
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.5.5.jar|appengine-api-labs-1.5.5.jar|appengine-jsr107cache-1.5.5.jar|jsr107cache-1.1.jar|datanucleus-appengine-1.0.9.final.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar
|
||||
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.6.3.jar|appengine-api-labs-1.6.3.jar|appengine-jsr107cache-1.6.3.jar|jsr107cache-1.1.jar|datanucleus-appengine-1.0.10.final.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar
|
||||
gaeDeployDialogSettings=
|
||||
gaeIsEclipseDefaultInstPath=true
|
||||
googleCloudSqlEnabled=false
|
||||
localDevMySqlEnabled=true
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -9,6 +9,7 @@ import java.net.ServerSocket;
|
|||
import java.net.Socket;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
|
|
@ -20,27 +21,27 @@ import org.intrace.shared.AgentConfigConstants;
|
|||
* This class wraps the state associated with a single InTrace enabled launch.
|
||||
*/
|
||||
public class InTraceLaunch implements Runnable
|
||||
{
|
||||
{
|
||||
/**
|
||||
* Server socket used for callback connection from InTrace agent
|
||||
*/
|
||||
private final ServerSocket callbackserver;
|
||||
|
||||
|
||||
/**
|
||||
* Active connection established as part of InTrace callback
|
||||
*/
|
||||
private Socket clientConnection = null;
|
||||
|
||||
|
||||
/**
|
||||
* Server port which the InTrace agent is listening on
|
||||
*/
|
||||
public String agentServerPort = null;
|
||||
|
||||
|
||||
/**
|
||||
* Currently active InTrace editor
|
||||
*/
|
||||
private InTraceEditor editor = null;
|
||||
|
||||
|
||||
/**
|
||||
* Action which opens the InTrace editor
|
||||
*/
|
||||
|
|
@ -49,19 +50,28 @@ public class InTraceLaunch implements Runnable
|
|||
/**
|
||||
* Main class being launched
|
||||
*/
|
||||
private final String mainClass;
|
||||
public final String mainClass;
|
||||
|
||||
/**
|
||||
* Associated launch configuration
|
||||
*/
|
||||
public final ILaunchConfiguration configuration;
|
||||
|
||||
/**
|
||||
* Construct an instance to listen on a provided ServerSocket
|
||||
* @param xiMainClass
|
||||
* @param xiMainClass
|
||||
* @param xiServer
|
||||
* @param xiConfiguration
|
||||
*/
|
||||
public InTraceLaunch(String xiMainClass, ServerSocket xiServer)
|
||||
public InTraceLaunch(String xiMainClass,
|
||||
ServerSocket xiServer,
|
||||
ILaunchConfiguration xiConfiguration)
|
||||
{
|
||||
this.mainClass = xiMainClass;
|
||||
this.callbackserver = xiServer;
|
||||
this.callbackserver = xiServer;
|
||||
this.configuration = xiConfiguration;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run()
|
||||
|
|
@ -70,13 +80,13 @@ public class InTraceLaunch implements Runnable
|
|||
{
|
||||
// Listen for incoming callback connection
|
||||
clientConnection = callbackserver.accept();
|
||||
|
||||
// Connected! Time to discover the server port.
|
||||
|
||||
// Connected! Time to discover the server port.
|
||||
ObjectOutputStream out = new ObjectOutputStream(clientConnection.getOutputStream());
|
||||
out.writeObject("getsettings");
|
||||
out.flush();
|
||||
|
||||
// Read the returned settings, discard any instrumentation status messages
|
||||
|
||||
// Read the returned settings, discard any instrumentation status messages
|
||||
ObjectInputStream in;
|
||||
while (agentServerPort == null)
|
||||
{
|
||||
|
|
@ -88,29 +98,17 @@ public class InTraceLaunch implements Runnable
|
|||
agentServerPort = settingsMap.get(AgentConfigConstants.SERVER_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the main class for instrumenation
|
||||
if (mainClass != null)
|
||||
{
|
||||
out = new ObjectOutputStream(clientConnection.getOutputStream());
|
||||
out.writeObject(AgentConfigConstants.CLASS_REGEX + mainClass);
|
||||
out.flush();
|
||||
|
||||
// Read the response and ignore it
|
||||
in = new ObjectInputStream(clientConnection.getInputStream());
|
||||
in.readObject();
|
||||
}
|
||||
|
||||
|
||||
// Notify the UI that we have got a connection
|
||||
notifyClientConnection();
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
Util.handleStatus(Util.createErrorStatus("Error during InTrace launch", th),
|
||||
Util.handleStatus(Util.createErrorStatus("Error during InTrace launch", th),
|
||||
StatusManager.SHOW | StatusManager.LOG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark that a connection is ready
|
||||
*/
|
||||
|
|
@ -142,7 +140,7 @@ public class InTraceLaunch implements Runnable
|
|||
}
|
||||
return clientConnection;
|
||||
}
|
||||
|
||||
|
||||
public synchronized InTraceEditor getEditor()
|
||||
{
|
||||
return editor;
|
||||
|
|
@ -157,11 +155,11 @@ public class InTraceLaunch implements Runnable
|
|||
{
|
||||
this.openeditoraction = openeditoraction;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void destroy()
|
||||
{
|
||||
final IAction action = openeditoraction;
|
||||
|
||||
|
||||
if (action != null)
|
||||
{
|
||||
// Disable action
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package intrace.ecl.ui.launching;
|
||||
|
||||
import intrace.ecl.Activator;
|
||||
import intrace.ecl.Util;
|
||||
import intrace.ecl.ui.output.InTraceEditor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -8,11 +10,13 @@ import java.util.List;
|
|||
|
||||
import net.miginfocom.swt.MigLayout;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
|
@ -22,27 +26,35 @@ import org.eclipse.swt.widgets.Control;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
import org.intrace.client.gui.helper.ClientStrings;
|
||||
import org.intrace.client.gui.helper.InTraceUI;
|
||||
import org.intrace.client.gui.helper.TraceFilterThread;
|
||||
import org.intrace.client.gui.helper.InTraceUI.UIMode;
|
||||
import org.intrace.client.gui.helper.InTraceUI.UIModeData;
|
||||
import org.intrace.client.gui.helper.IncludeExcludeWindow;
|
||||
import org.intrace.client.gui.helper.IncludeExcludeWindow.PatternInputCallback;
|
||||
import org.intrace.client.gui.helper.TraceFilterThread;
|
||||
|
||||
class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
||||
public class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
||||
{
|
||||
private Image icon16;
|
||||
private Display display;
|
||||
private Composite composite;
|
||||
private Button classesButton;
|
||||
|
||||
private String classRegex = "";
|
||||
private String classExcludeRegex = "";
|
||||
|
||||
private List<String> includePattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> excludePattern = TraceFilterThread.MATCH_NONE;
|
||||
|
||||
|
||||
private String classIncludePattern = "";
|
||||
private String classExcludePattern = "";
|
||||
|
||||
private List<String> outputIncludePattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> outputExcludePattern = TraceFilterThread.MATCH_NONE;
|
||||
|
||||
private Button textFilter;
|
||||
|
||||
public static final String CLASS_INCL_ATTR = "INTRACE_CLASS_INCL_ATTR";
|
||||
public static final String CLASS_EXCL_ATTR = "INTRACE_CLASS_EXCL_ATTR";
|
||||
public static final String OUTPUT_INCL_ATTR = "OUTPUT_CLASS_INCL_ATTR";
|
||||
public static final String OUTPUT_EXCL_ATTR = "OUTPUT_CLASS_EXCL_ATTR";
|
||||
|
||||
private ILaunchConfigurationDialog dialog;
|
||||
private ILaunchConfigurationWorkingCopy wc;
|
||||
|
||||
@Override
|
||||
public void createControl(Composite parent)
|
||||
{
|
||||
|
|
@ -51,13 +63,13 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
|
||||
composite = new Composite(parent, SWT.NONE);
|
||||
composite.setLayout(tabLayout);
|
||||
|
||||
|
||||
classesButton = new Button(composite, SWT.PUSH);
|
||||
classesButton.setText("Classes To Trace...");
|
||||
classesButton.setLayoutData("growx,wrap");
|
||||
|
||||
final UIModeData modeData = InTraceEditor.getUIModeData();
|
||||
|
||||
|
||||
classesButton
|
||||
.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter()
|
||||
{
|
||||
|
|
@ -69,73 +81,76 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
modeData,
|
||||
new PatternInputCallback()
|
||||
{
|
||||
private List<String> includePattern = null;
|
||||
private List<String> excludePattern = null;
|
||||
private List<String> localIncludePattern = null;
|
||||
private List<String> localExcludePattern = null;
|
||||
|
||||
@Override
|
||||
public void setIncludePattern(List<String> newIncludePattern)
|
||||
{
|
||||
includePattern = newIncludePattern;
|
||||
localIncludePattern = newIncludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExcludePattern(List<String> newExcludePattern)
|
||||
{
|
||||
excludePattern = newExcludePattern;
|
||||
localExcludePattern = newExcludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
private void savePatterns()
|
||||
{
|
||||
if ((includePattern != null) && (excludePattern != null))
|
||||
if ((localIncludePattern != null) && (localExcludePattern != null))
|
||||
{
|
||||
setRegex(InTraceUI.getStringFromList(includePattern),
|
||||
InTraceUI.getStringFromList(excludePattern));
|
||||
setRegex(InTraceUI.getStringFromList(localIncludePattern),
|
||||
InTraceUI.getStringFromList(localExcludePattern));
|
||||
}
|
||||
}
|
||||
},
|
||||
InTraceUI.getListFromString(classRegex),
|
||||
InTraceUI.getListFromString(classExcludeRegex),
|
||||
},
|
||||
InTraceUI.getListFromString(classIncludePattern),
|
||||
InTraceUI.getListFromString(classExcludePattern),
|
||||
InTraceUI.ALLOW_CLASSES);
|
||||
InTraceUI.placeDialogInCenter(display.getBounds(), regexInput.sWindow);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
textFilter = new Button(composite, SWT.PUSH);
|
||||
textFilter.setText("Trace Filters...");
|
||||
textFilter.setLayoutData("growx");
|
||||
|
||||
|
||||
final PatternInputCallback patternCallback = new PatternInputCallback()
|
||||
{
|
||||
private List<String> localIncludePattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> localExcludePattern = TraceFilterThread.MATCH_NONE;
|
||||
|
||||
@Override
|
||||
public void setIncludePattern(List<String> newIncludePattern)
|
||||
{
|
||||
includePattern = newIncludePattern;
|
||||
localIncludePattern = newIncludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExcludePattern(List<String> newExcludePattern)
|
||||
{
|
||||
excludePattern = newExcludePattern;
|
||||
localExcludePattern = newExcludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
private void savePatterns()
|
||||
{
|
||||
if ((includePattern != null) && (excludePattern != null))
|
||||
if ((localIncludePattern != null) && (localExcludePattern != null))
|
||||
{
|
||||
if (includePattern.equals(TraceFilterThread.MATCH_NONE) &&
|
||||
excludePattern.equals(TraceFilterThread.MATCH_NONE))
|
||||
if (localIncludePattern.equals(TraceFilterThread.MATCH_NONE) &&
|
||||
localExcludePattern.equals(TraceFilterThread.MATCH_NONE))
|
||||
{
|
||||
includePattern = TraceFilterThread.MATCH_ALL;
|
||||
localIncludePattern = TraceFilterThread.MATCH_ALL;
|
||||
}
|
||||
applyPatterns(includePattern, excludePattern);
|
||||
applyPatterns(localIncludePattern, localExcludePattern);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
textFilter
|
||||
.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter()
|
||||
{
|
||||
|
|
@ -145,25 +160,33 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
IncludeExcludeWindow regexInput;
|
||||
regexInput = new IncludeExcludeWindow("Output Filter", ClientStrings.FILTER_HELP_TEXT, UIMode.ECLIPSE,
|
||||
modeData,
|
||||
patternCallback,
|
||||
includePattern,
|
||||
excludePattern,
|
||||
patternCallback,
|
||||
outputIncludePattern,
|
||||
outputExcludePattern,
|
||||
InTraceUI.ALLOW_ALL);
|
||||
InTraceUI.placeDialogInCenter(display.getBounds(), regexInput.sWindow);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setRegex(String stringFromList,
|
||||
String stringFromList2)
|
||||
private void setRegex(String classIncludePattern,
|
||||
String classExcludePattern)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
this.classIncludePattern = classIncludePattern;
|
||||
this.classExcludePattern = classExcludePattern;
|
||||
wc.setAttribute(CLASS_INCL_ATTR, classIncludePattern);
|
||||
wc.setAttribute(CLASS_EXCL_ATTR, classExcludePattern);
|
||||
dialog.updateButtons();
|
||||
}
|
||||
|
||||
private void applyPatterns(List<String> includePattern2,
|
||||
List<String> excludePattern2)
|
||||
private void applyPatterns(List<String> outputIncludePattern,
|
||||
List<String> outputExcludePattern)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
this.outputIncludePattern = outputIncludePattern;
|
||||
this.outputExcludePattern = outputExcludePattern;
|
||||
wc.setAttribute(OUTPUT_INCL_ATTR, outputIncludePattern);
|
||||
wc.setAttribute(OUTPUT_EXCL_ATTR, outputExcludePattern);
|
||||
dialog.updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -175,31 +198,53 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
@Override
|
||||
public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog)
|
||||
{
|
||||
// Do nothing
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initializeFrom(ILaunchConfiguration configuration)
|
||||
{
|
||||
// Ignore
|
||||
try
|
||||
{
|
||||
classIncludePattern = configuration.getAttribute(CLASS_INCL_ATTR, "");
|
||||
classExcludePattern = configuration.getAttribute(CLASS_EXCL_ATTR, "");
|
||||
outputIncludePattern = configuration.getAttribute(OUTPUT_INCL_ATTR, TraceFilterThread.MATCH_ALL);
|
||||
outputExcludePattern = configuration.getAttribute(OUTPUT_EXCL_ATTR, TraceFilterThread.MATCH_NONE);
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
|
||||
{
|
||||
// Do nothing
|
||||
try
|
||||
{
|
||||
String mainClass = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "");
|
||||
configuration.setAttribute(CLASS_INCL_ATTR, mainClass);
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose()
|
||||
{
|
||||
icon16.dispose();
|
||||
if (icon16 != null)
|
||||
{
|
||||
icon16.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performApply(ILaunchConfigurationWorkingCopy configuration)
|
||||
{
|
||||
// Ignore
|
||||
// ??
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -223,7 +268,7 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
@Override
|
||||
public boolean canSave()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -243,7 +288,7 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
{
|
||||
ClassLoader loader = InTraceLaunchConfigTab.class.getClassLoader();
|
||||
InputStream is16 = loader.getResourceAsStream(
|
||||
"org/intrace/icons/intrace16.gif");
|
||||
"org/intrace/icons/intrace16.gif");
|
||||
icon16 = new Image(display, is16);
|
||||
try
|
||||
{
|
||||
|
|
@ -259,12 +304,12 @@ class InTraceLaunchConfigTab implements ILaunchConfigurationTab
|
|||
@Override
|
||||
public void activated(ILaunchConfigurationWorkingCopy workingCopy)
|
||||
{
|
||||
// Ignore
|
||||
this.wc = workingCopy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,12 +45,12 @@ public class LaunchConfigurationDelegate extends
|
|||
* Config key used to save the launch ID into an ILaunch object
|
||||
*/
|
||||
public static final String INTRACE_LAUNCHKEY = "INTRACE_LAUNCHKEY";
|
||||
|
||||
|
||||
/**
|
||||
* Map of active launches
|
||||
*/
|
||||
public static final Map<Long, InTraceLaunch> intraceLaunches = new ConcurrentHashMap<Long, InTraceLaunch>();
|
||||
|
||||
|
||||
/**
|
||||
* AtommicLong used to generate launch IDs
|
||||
*/
|
||||
|
|
@ -68,6 +68,7 @@ public class LaunchConfigurationDelegate extends
|
|||
|
||||
// IExecutableExtension interface:
|
||||
|
||||
@Override
|
||||
public void setInitializationData(IConfigurationElement config,
|
||||
String propertyName, Object data) throws CoreException
|
||||
{
|
||||
|
|
@ -99,24 +100,36 @@ public class LaunchConfigurationDelegate extends
|
|||
{
|
||||
// Create working copy launch config
|
||||
ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
|
||||
|
||||
|
||||
// Identify the main class
|
||||
String mainClass = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "");
|
||||
|
||||
|
||||
// Make sure main class will be instrumented
|
||||
String classIncludePattern = configuration.getAttribute(InTraceLaunchConfigTab.CLASS_INCL_ATTR, "");
|
||||
if ("".equals(classIncludePattern))
|
||||
{
|
||||
classIncludePattern = mainClass;
|
||||
ILaunchConfigurationWorkingCopy wc2 = configuration.getWorkingCopy();
|
||||
wc2.setAttribute(InTraceLaunchConfigTab.CLASS_INCL_ATTR, classIncludePattern);
|
||||
wc2.doSave();
|
||||
}
|
||||
|
||||
// Prepare InTraceLaunch object to handle callback connection
|
||||
ServerSocket callbackServer = new ServerSocket(0);
|
||||
final InTraceLaunch intraceLaunch = new InTraceLaunch(mainClass, callbackServer);
|
||||
final InTraceLaunch intraceLaunch = new InTraceLaunch(mainClass,
|
||||
callbackServer,
|
||||
configuration);
|
||||
intraceLaunch.start();
|
||||
|
||||
|
||||
// Save off launch object for later access
|
||||
Long connId = intraceLaunchId.getAndIncrement();
|
||||
intraceLaunches.put(connId, intraceLaunch);
|
||||
launch.setAttribute(INTRACE_LAUNCHKEY, Long.toString(connId));
|
||||
|
||||
|
||||
// Setup a launch listener to cleanup the intrace launch object
|
||||
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
|
||||
manager.addLaunchListener(new LaunchListener(launch, connId));
|
||||
|
||||
manager.addLaunchListener(new LaunchListener(launch, connId));
|
||||
|
||||
// Add VM arguments
|
||||
String vmArgs = wc.getAttribute(
|
||||
IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "");
|
||||
|
|
@ -148,7 +161,7 @@ public class LaunchConfigurationDelegate extends
|
|||
}
|
||||
catch (PartInitException ex)
|
||||
{
|
||||
Util.handleStatus(Util.createErrorStatus("Failed to open InTrace Output", ex),
|
||||
Util.handleStatus(Util.createErrorStatus("Failed to open InTrace Output", ex),
|
||||
StatusManager.SHOW);
|
||||
}
|
||||
}
|
||||
|
|
@ -160,11 +173,11 @@ public class LaunchConfigurationDelegate extends
|
|||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
Util.handleStatus(Util.createErrorStatus("InTrace launch failed", e1),
|
||||
Util.handleStatus(Util.createErrorStatus("InTrace launch failed", e1),
|
||||
StatusManager.SHOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Launch listener which handles the cleanup of entries in the intraceLaunches map
|
||||
*/
|
||||
|
|
@ -179,7 +192,7 @@ public class LaunchConfigurationDelegate extends
|
|||
|
||||
private final ILaunch targetlaunch;
|
||||
private final Long intraceLaunchId;
|
||||
|
||||
|
||||
@Override
|
||||
public void launchesRemoved(ILaunch[] launches)
|
||||
{
|
||||
|
|
@ -206,17 +219,17 @@ public class LaunchConfigurationDelegate extends
|
|||
if (launch == targetlaunch)
|
||||
{
|
||||
InTraceLaunch intraceLaunch = intraceLaunches.remove(intraceLaunchId);
|
||||
|
||||
|
||||
if (intraceLaunch != null)
|
||||
{
|
||||
intraceLaunch.destroy();
|
||||
}
|
||||
|
||||
|
||||
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
|
||||
manager.removeLaunchListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package intrace.ecl.ui.launching;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import intrace.ecl.Util;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class EditorInput implements IEditorInput
|
|||
{
|
||||
public final InTraceLaunch callback;
|
||||
public final InputType type;
|
||||
|
||||
|
||||
public enum InputType
|
||||
{
|
||||
NEWCONNECTION,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
package intrace.ecl.ui.output;
|
||||
|
||||
import intrace.ecl.Activator;
|
||||
import intrace.ecl.Util;
|
||||
import intrace.ecl.ui.launching.InTraceLaunchConfigTab;
|
||||
import intrace.ecl.ui.output.EditorInput.InputType;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jface.resource.ColorRegistry;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
|
@ -21,13 +28,16 @@ import org.eclipse.ui.part.EditorPart;
|
|||
import org.eclipse.ui.themes.ITheme;
|
||||
import org.intrace.client.gui.helper.Connection.ConnectState;
|
||||
import org.intrace.client.gui.helper.InTraceUI;
|
||||
import org.intrace.client.gui.helper.InTraceUI.ConfigDataInterface;
|
||||
import org.intrace.client.gui.helper.InTraceUI.ConfigDataInterface.Callback;
|
||||
import org.intrace.client.gui.helper.InTraceUI.IConnectionStateCallback;
|
||||
import org.intrace.client.gui.helper.InTraceUI.UIMode;
|
||||
import org.intrace.client.gui.helper.InTraceUI.UIModeData;
|
||||
import org.intrace.client.gui.helper.TraceFilterThread;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class InTraceEditor extends EditorPart
|
||||
{
|
||||
{
|
||||
private InTraceUI inTraceUI;
|
||||
private EditorInput intraceInput;
|
||||
|
||||
|
|
@ -37,37 +47,118 @@ public class InTraceEditor extends EditorPart
|
|||
}
|
||||
|
||||
public static UIModeData getUIModeData()
|
||||
{
|
||||
{
|
||||
IWorkbench workBench = PlatformUI.getWorkbench();
|
||||
ITheme theme = workBench.getThemeManager().getCurrentTheme();
|
||||
ColorRegistry colreg = theme.getColorRegistry();
|
||||
|
||||
|
||||
Color c1 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
|
||||
Color c2 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
|
||||
UIModeData data = new UIModeData(c1, c2);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void createPartControl(final Composite parent)
|
||||
{
|
||||
Composite ui = new Composite(parent, SWT.NONE);
|
||||
|
||||
UIModeData data = getUIModeData();
|
||||
|
||||
|
||||
intraceInput = (EditorInput)getEditorInput();
|
||||
|
||||
final ILaunchConfiguration config = intraceInput.callback.configuration;
|
||||
String classIncludePattern = null;
|
||||
String classExcludePattern = null;
|
||||
List<String> outputIncludePattern = null;
|
||||
List<String> outputExcludePattern = null;
|
||||
|
||||
if (intraceInput.type == InputType.NEWCONNECTION)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Only apply class patterns for a new connection as the agent will remember them
|
||||
// for an existing connection.
|
||||
classIncludePattern = config.getAttribute(InTraceLaunchConfigTab.CLASS_INCL_ATTR, "");
|
||||
classExcludePattern = config.getAttribute(InTraceLaunchConfigTab.CLASS_EXCL_ATTR, "");
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
outputIncludePattern = config.getAttribute(InTraceLaunchConfigTab.OUTPUT_INCL_ATTR, TraceFilterThread.MATCH_ALL);
|
||||
outputExcludePattern = config.getAttribute(InTraceLaunchConfigTab.OUTPUT_EXCL_ATTR, TraceFilterThread.MATCH_NONE);
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
|
||||
Callback cb = new Callback()
|
||||
{
|
||||
@Override
|
||||
public void setClassConfig(String classIncludePattern,
|
||||
String classExcludePattern)
|
||||
{
|
||||
try
|
||||
{
|
||||
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
||||
|
||||
wc.setAttribute(InTraceLaunchConfigTab.CLASS_INCL_ATTR, classIncludePattern);
|
||||
wc.setAttribute(InTraceLaunchConfigTab.CLASS_EXCL_ATTR, classExcludePattern);
|
||||
|
||||
wc.doSave();
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputConfig(List<String> outputIncludePattern,
|
||||
List<String> outputExcludePattern)
|
||||
{
|
||||
try
|
||||
{
|
||||
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
||||
|
||||
wc.setAttribute(InTraceLaunchConfigTab.OUTPUT_INCL_ATTR, outputIncludePattern);
|
||||
wc.setAttribute(InTraceLaunchConfigTab.OUTPUT_EXCL_ATTR, outputExcludePattern);
|
||||
|
||||
wc.doSave();
|
||||
}
|
||||
catch (CoreException e)
|
||||
{
|
||||
Activator.getDefault().getLog().log(Util.createErrorStatus("Error", e));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ConfigDataInterface configInterface = new ConfigDataInterface(classIncludePattern,
|
||||
classExcludePattern,
|
||||
outputIncludePattern,
|
||||
outputExcludePattern,
|
||||
cb);
|
||||
|
||||
IWorkbench workbench = PlatformUI.getWorkbench();
|
||||
final Display display = workbench.getDisplay();
|
||||
Shell window = display.getActiveShell();
|
||||
inTraceUI = new InTraceUI(window, ui, UIMode.ECLIPSE, data);
|
||||
inTraceUI = new InTraceUI(window, ui, UIMode.ECLIPSE, data, configInterface);
|
||||
inTraceUI.setConnCallback(new IConnectionStateCallback()
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void setConnectionState(final ConnectState state)
|
||||
{
|
||||
if (!parent.isDisposed())
|
||||
{
|
||||
display.syncExec(new Runnable()
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
|
@ -78,23 +169,23 @@ public class InTraceEditor extends EditorPart
|
|||
}
|
||||
});
|
||||
inTraceUI.setConnectionState(ConnectState.CONNECTING);
|
||||
intraceInput = (EditorInput)getEditorInput();
|
||||
|
||||
if (intraceInput.type == InputType.NEWCONNECTION)
|
||||
{
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Socket connection = intraceInput.callback.getClientConnection();
|
||||
inTraceUI.setFixedLocalConnection(connection);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
|
@ -106,12 +197,12 @@ public class InTraceEditor extends EditorPart
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(IEditorSite site,
|
||||
public void init(IEditorSite site,
|
||||
IEditorInput input)
|
||||
throws PartInitException
|
||||
{
|
||||
setSite(site);
|
||||
setInput(input);
|
||||
setInput(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -121,16 +212,19 @@ public class InTraceEditor extends EditorPart
|
|||
{
|
||||
intraceInput.callback.setEditor(null);
|
||||
}
|
||||
inTraceUI.dispose();
|
||||
if (inTraceUI != null)
|
||||
{
|
||||
inTraceUI.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFocus()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doSave(IProgressMonitor monitor)
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -17,31 +17,31 @@ public class InTraceStandaloneUI
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
{
|
||||
// Prepare window
|
||||
Display.setAppName("InTrace");
|
||||
final Shell window = new Shell();
|
||||
window.setSize(new Point(800, 800));
|
||||
window.setMinimumSize(new Point(800, 480));
|
||||
|
||||
window.setMinimumSize(new Point(800, 480));
|
||||
|
||||
// Load icons
|
||||
Display display = window.getDisplay();
|
||||
Image[] icons = InTraceUI.getIcons(display);
|
||||
window.setImages(icons);
|
||||
|
||||
|
||||
// Fill in UI
|
||||
InTraceUI ui = new InTraceUI(window, window, UIMode.STANDALONE, null);
|
||||
|
||||
InTraceUI ui = new InTraceUI(window, window, UIMode.STANDALONE, null, null);
|
||||
|
||||
// Register title callback
|
||||
ui.setConnCallback(new IConnectionStateCallback()
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void setConnectionState(final ConnectState state)
|
||||
{
|
||||
if (!window.isDisposed())
|
||||
{
|
||||
window.getDisplay().syncExec(new Runnable()
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
|
@ -51,7 +51,7 @@ public class InTraceStandaloneUI
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Open UI
|
||||
ui.open();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,28 +78,6 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
|
||||
public void open()
|
||||
{
|
||||
// new Thread()
|
||||
// {
|
||||
// public void run()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Thread.sleep(500);
|
||||
// }
|
||||
// catch (InterruptedException e)
|
||||
// {
|
||||
// // Ignore
|
||||
// }
|
||||
// sWindow.getDisplay().syncExec(new Runnable()
|
||||
// {
|
||||
// @Override
|
||||
// public void run()
|
||||
// {
|
||||
// startProgramBar.show();
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
// }.start();
|
||||
placeDialogInCenter(sWindow.getDisplay().getPrimaryMonitor().getBounds(),
|
||||
sWindow);
|
||||
sWindow.open();
|
||||
|
|
@ -127,6 +105,8 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
final private StartProgramBar startProgramBar;
|
||||
final private OutputTabs outputTabs;
|
||||
|
||||
private final ConfigDataInterface configInterface;
|
||||
|
||||
public void setConnCallback(IConnectionStateCallback connCallback)
|
||||
{
|
||||
this.connCallback = connCallback;
|
||||
|
|
@ -153,12 +133,56 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
public final Color colorTwo;
|
||||
}
|
||||
|
||||
public InTraceUI(Shell xiWindow, Composite xiRoot, UIMode xiMode, UIModeData xiModeData)
|
||||
public static class ConfigDataInterface
|
||||
{
|
||||
public final String classIncludePattern;
|
||||
public final String classExcludePattern;
|
||||
|
||||
public final List<String> outputIncludePattern;
|
||||
public final List<String> outputExcludePattern;
|
||||
public final Callback callback;
|
||||
|
||||
public ConfigDataInterface(String classIncludePattern,
|
||||
String classExcludePattern,
|
||||
List<String> outputIncludePattern,
|
||||
List<String> outputExcludePattern,
|
||||
Callback callback)
|
||||
{
|
||||
this.classIncludePattern = classIncludePattern;
|
||||
this.classExcludePattern = classExcludePattern;
|
||||
this.outputIncludePattern = outputIncludePattern;
|
||||
this.outputExcludePattern = outputExcludePattern;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public static interface Callback
|
||||
{
|
||||
public void setClassConfig(String classIncludePattern,
|
||||
String classExcludePattern);
|
||||
public void setOutputConfig(List<String> outputIncludePattern,
|
||||
List<String> outputExcludePattern);
|
||||
}
|
||||
}
|
||||
|
||||
public InTraceUI(Shell xiWindow,
|
||||
Composite xiRoot,
|
||||
UIMode xiMode,
|
||||
UIModeData xiModeData,
|
||||
ConfigDataInterface xiConfigInterface)
|
||||
{
|
||||
sWindow = xiWindow;
|
||||
sRoot = xiRoot;
|
||||
mode = xiMode;
|
||||
modeData = xiModeData;
|
||||
configInterface = xiConfigInterface;
|
||||
|
||||
if ((configInterface != null) &&
|
||||
(configInterface.classIncludePattern != null) &&
|
||||
(configInterface.classExcludePattern != null))
|
||||
{
|
||||
settingsData.classRegex = configInterface.classIncludePattern;
|
||||
settingsData.classExcludeRegex = configInterface.classExcludePattern;
|
||||
}
|
||||
|
||||
rootLayout = new MigLayout("fill,hidemode 2", "[]", "0[]0[]0[]0[]0[grow]");
|
||||
xiRoot.setLayout(rootLayout);
|
||||
|
|
@ -189,6 +213,21 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
outputTabs = new OutputTabs(xiRoot);
|
||||
outputTabs.composite.setLayoutData("grow,wmin 0,hmin 0");
|
||||
|
||||
if ((configInterface != null) &&
|
||||
(configInterface.outputIncludePattern != null) &&
|
||||
(configInterface.outputExcludePattern != null))
|
||||
{
|
||||
lastEnteredIncludeFilterPattern = configInterface.outputIncludePattern;
|
||||
lastEnteredExcludeFilterPattern = configInterface.outputExcludePattern;
|
||||
if (outputTabs.textOutputTab.enableFilter.getSelection())
|
||||
{
|
||||
outputTabs.textOutputTab.
|
||||
applyPatterns(configInterface.outputIncludePattern,
|
||||
configInterface.outputExcludePattern, false,
|
||||
settingsTabs.localOutputSettingsTab.discardFiltered.getSelection());
|
||||
}
|
||||
}
|
||||
|
||||
updateUIStateSameThread();
|
||||
|
||||
sWindow.getDisplay().addFilter(SWT.KeyDown, new Listener()
|
||||
|
|
@ -1418,6 +1457,12 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
}
|
||||
lastEnteredIncludeFilterPattern = includePattern;
|
||||
lastEnteredExcludeFilterPattern = excludePattern;
|
||||
|
||||
if (configInterface != null)
|
||||
{
|
||||
configInterface.callback.setOutputConfig(includePattern, excludePattern);
|
||||
}
|
||||
|
||||
if (enableFilter.getSelection())
|
||||
{
|
||||
applyPatterns(includePattern, excludePattern, false,
|
||||
|
|
@ -1897,8 +1942,7 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
private ControlConnectionThread controlThread;
|
||||
|
||||
// Settings
|
||||
private ParsedSettingsData settingsData = new ParsedSettingsData(
|
||||
new HashMap<String, String>());
|
||||
private ParsedSettingsData settingsData = new ParsedSettingsData(new HashMap<String, String>());
|
||||
|
||||
private List<String> lastEnteredIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> activeIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
|
|
@ -1921,6 +1965,16 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
remoteAddress = socket.getInetAddress();
|
||||
controlThread = new ControlConnectionThread(socket, this);
|
||||
controlThread.start();
|
||||
|
||||
if ((configInterface != null) &&
|
||||
(configInterface.classIncludePattern != null) &&
|
||||
(configInterface.classExcludePattern != null))
|
||||
{
|
||||
controlThread.sendMessage(
|
||||
AgentConfigConstants.CLASS_REGEX + configInterface.classIncludePattern
|
||||
+ AgentConfigConstants.EXCLUDE_CLASS_REGEX + configInterface.classExcludePattern);
|
||||
}
|
||||
|
||||
controlThread.sendMessage("getsettings");
|
||||
setConnectionState(ConnectState.CONNECTED);
|
||||
|
||||
|
|
@ -2251,6 +2305,15 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
outputTabs.textOutputTab.filterThread
|
||||
.addSystemTraceLine("Latest Settings Received");
|
||||
settingsData = new ParsedSettingsData(settingsMap);
|
||||
|
||||
if ((configInterface != null) &&
|
||||
(settingsData.classRegex != null) &&
|
||||
(settingsData.classExcludeRegex != null))
|
||||
{
|
||||
configInterface.callback.setClassConfig(settingsData.classRegex,
|
||||
settingsData.classExcludeRegex);
|
||||
}
|
||||
|
||||
setConnectionState(ConnectState.CONNECTED);
|
||||
updateUIStateSameThread();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue