Use correct colors in eclipse tabs

Fix class exclude filters
Fix NPE in agent launch
This commit is contained in:
mchr3k 2011-07-13 12:51:02 +01:00
parent 5edeb1b9a4
commit 9332eadeea
10 changed files with 53 additions and 29 deletions

View File

@ -2,7 +2,7 @@
<feature
id="intrace.ecl.feature"
label="InTrace Eclipse Plugin"
version="0.11">
version="0.12">
<description url="https://github.com/mchr3k/org.intrace/wiki">
Enable launching Java Applications with the InTrace agent.
@ -20,6 +20,6 @@
id="intrace.ecl"
download-size="0"
install-size="0"
version="0.11.0"/>
version="0.12.0"/>
</feature>

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: InTrace Eclipse
Bundle-SymbolicName: intrace.ecl;singleton:=true
Bundle-Version: 0.11
Bundle-Version: 0.12
Bundle-Activator: intrace.ecl.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,

View File

@ -6,6 +6,7 @@ import java.net.Socket;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@ -22,7 +23,9 @@ import org.intrace.client.gui.helper.Connection.ConnectState;
import org.intrace.client.gui.helper.InTraceUI;
import org.intrace.client.gui.helper.InTraceUI.IConnectionStateCallback;
import org.intrace.client.gui.helper.InTraceUI.UIMode;
import org.intrace.client.gui.helper.InTraceUI.UIModeData;
@SuppressWarnings("restriction")
public class InTraceEditor extends EditorPart
{
private InTraceUI inTraceUI;
@ -36,18 +39,20 @@ public class InTraceEditor extends EditorPart
@Override
public void createPartControl(final Composite parent)
{
Composite ui = new Composite(parent, SWT.NONE);
IWorkbench workBench = PlatformUI.getWorkbench();
ITheme theme = workBench.getThemeManager().getCurrentTheme();
ColorRegistry colreg = theme.getColorRegistry();
@SuppressWarnings("restriction")
Color c1 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
// TODO
Color c2 = colreg.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
UIModeData data = new UIModeData(c1, c2);
IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
Shell window = display.getActiveShell();
inTraceUI = new InTraceUI(window, parent, UIMode.ECLIPSE);
inTraceUI = new InTraceUI(window, ui, UIMode.ECLIPSE, data);
inTraceUI.setConnCallback(new IConnectionStateCallback()
{
@Override

View File

@ -3,7 +3,7 @@
<description name="InTrace Update Site">
InTrace Update Site
</description>
<feature url="features/intrace.ecl.feature_0.11.0.jar" id="intrace.ecl.feature" version="0.11">
<feature url="features/intrace.ecl.feature_0.12.0.jar" id="intrace.ecl.feature" version="0.12">
<category name="intrace.ecl.category"/>
</feature>
<category-def name="intrace.ecl.category" label="InTrace Eclipse Plugin"/>

Binary file not shown.

View File

@ -42,9 +42,15 @@ public class Agent
try
{
// Prepare boot classpath
String agentPath = Agent.class.getProtectionDomain().getCodeSource()
.getLocation().getPath();
if (!agentPath.endsWith(".jar"))
String agentPath = null;
if ((Agent.class.getProtectionDomain() != null) &&
(Agent.class.getProtectionDomain().getCodeSource() != null) &&
(Agent.class.getProtectionDomain().getCodeSource().getLocation() != null))
{
agentPath = Agent.class.getProtectionDomain().getCodeSource().getLocation().getPath();
}
if ((agentPath == null) || !agentPath.endsWith(".jar"))
{
System.err.println("InTrace agent must be loaded from a .jar file. Detected path: " + agentPath);
System.err.println("InTrace loading cancelled.");

View File

@ -30,7 +30,7 @@ public class InTraceStandaloneUI
window.setImages(icons);
// Fill in UI
InTraceUI ui = new InTraceUI(window, window, UIMode.STANDALONE);
InTraceUI ui = new InTraceUI(window, window, UIMode.STANDALONE, null);
// Register title callback
ui.setConnCallback(new IConnectionStateCallback()

View File

@ -92,6 +92,8 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
private final Shell sWindow;
private final Composite sRoot;
private final UIMode mode;
private final UIModeData modeData;
private IConnectionStateCallback connCallback = null;
private MigLayout rootLayout;
@ -117,11 +119,23 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
ECLIPSE
}
public InTraceUI(Shell xiWindow, Composite xiRoot, UIMode xiMode)
public static class UIModeData
{
public UIModeData(Color colorOne, Color colorTwo)
{
this.colorOne = colorOne;
this.colorTwo = colorTwo;
}
public final Color colorOne;
public final Color colorTwo;
}
public InTraceUI(Shell xiWindow, Composite xiRoot, UIMode xiMode, UIModeData xiModeData)
{
sWindow = xiWindow;
sRoot = xiRoot;
mode = xiMode;
modeData = xiModeData;
rootLayout = new MigLayout("fill,hidemode 2", "[]", "0[]0[]0[]0[]0[grow]");
xiRoot.setLayout(rootLayout);
@ -560,13 +574,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
private void show()
{
composite.setVisible(true);
sRoot.layout();
sRoot.layout(true, true);
}
private void hide()
{
composite.setVisible(false);
sRoot.layout();
sRoot.layout(true, true);
}
}
@ -602,19 +616,12 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
private void show()
{
composite.setVisible(true);
sRoot.layout();
sRoot.layout(true, true);
}
private void hide()
{
composite.setVisible(false);
if (mode == UIMode.ECLIPSE)
{
// Hack to make sure the form gets laid out correctly
Point p = sRoot.getSize();
sRoot.setSize(p.x+1, p.y+1);
sRoot.setSize(p);
}
sRoot.layout(true, true);
}
}
@ -662,6 +669,10 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
mSettingsCTabs = new CTabFolder(composite, SWT.TOP | SWT.BORDER);
mSettingsCTabs.setSimple(false);
mSettingsCTabs.setLayoutData("grow,wrap,wmin 0");
mSettingsCTabs.setSelectionBackground(
new Color[]{modeData.colorOne,
modeData.colorTwo},
new int[]{100}, true);
CTabItem traceTabItem = new CTabItem(mSettingsCTabs, SWT.NONE);
traceTabItem.setText("Trace");
@ -685,15 +696,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
private void show()
{
composite.setVisible(true);
sRoot.layout();
sRoot.layout(true, true);
}
private void hide()
{
composite.setVisible(false);
sRoot.layout();
sRoot.layout(true, true);
}
private class TraceTab
@ -815,7 +824,7 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
private ExtrasTab(Composite parent)
{
MigLayout windowLayout = new MigLayout("fill", "[120][120][160][160][grow]");
MigLayout windowLayout = new MigLayout("fill", "[120][120][120][160][grow]");
composite = new Composite(parent, SWT.NONE);
composite.setLayout(windowLayout);
@ -922,6 +931,10 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
mOutputCTabs = new CTabFolder(composite, SWT.TOP | SWT.BORDER);
mOutputCTabs.setSimple(false);
mOutputCTabs.setLayoutData("grow,wmin 0,hmin 0");
mOutputCTabs.setSelectionBackground(
new Color[]{modeData.colorOne,
modeData.colorTwo},
new int[]{100}, true);
CTabItem textOutputTabItem = new CTabItem(mOutputCTabs, SWT.NONE);
textOutputTabItem.setText("Output");
@ -1857,8 +1870,8 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
{
settingsData.classRegex = includePattern;
settingsData.classExcludeRegex = excludePattern;
controlThread.sendMessage("[regex-" + includePattern
+ "[excluderegex-" + excludePattern);
controlThread.sendMessage(AgentConfigConstants.CLASS_REGEX + includePattern
+ AgentConfigConstants.EXCLUDE_CLASS_REGEX + excludePattern);
controlThread.sendMessage("getsettings");
}
});