Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed May 25, 2015
1 parent 2782cd9 commit a7734b4
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
Expand Up @@ -99,6 +99,8 @@ public static enum BreakOnExceptions {

public static final String PREFS_SHOW_RUN_RESUME_DIALOG = "showRunResumeDialog";

public static final String PREFS_EXCLUDE_FROM_LOGICAL_STRUCTURE = "excludeFromLogicalStructure";

private ServiceTracker<DebugOptions, Object> debugTracker;

private IEclipsePreferences prefs;
Expand Down Expand Up @@ -229,6 +231,10 @@ public String getBrowserName() {
return getPrefs().get(PREFS_BROWSER_NAME, "");
}

public String getExcludeFromLogicalStructure() {
return getPrefs().get(PREFS_EXCLUDE_FROM_LOGICAL_STRUCTURE, "Window");
}

public boolean getInvokeToString() {
return getPrefs().getBoolean(PREFS_INVOKE_TOSTRING, true);
}
Expand Down Expand Up @@ -294,6 +300,18 @@ public void setBrowserPreferences(boolean useDefault, String name, String args)
}
}

public void setExcludeFromLogicalStructure(String excludeFromLogicalStructure) {
IEclipsePreferences prefs = getPrefs();

prefs.put(PREFS_EXCLUDE_FROM_LOGICAL_STRUCTURE, excludeFromLogicalStructure);

try {
getPrefs().flush();
} catch (BackingStoreException exception) {
logError(exception);
}
}

public void setInvokeToString(boolean value) {
getPrefs().putBoolean(PREFS_INVOKE_TOSTRING, value);
}
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

Expand All @@ -41,6 +42,8 @@ public class DebugPreferencePage extends PreferencePage implements IWorkbenchPre
private Button useSmartStepOverButton;
private Button useSmartStepInOutButton;

private Text excludeFromLogicalStructureText;

// private Button defaultBrowserButton;
// private Text browserNameText;
// private Button selectBrowserButton;
Expand All @@ -63,7 +66,8 @@ public boolean performOk() {
BreakOnExceptions.valueOf(exceptionsCombo.getText()));
SDBGDebugCorePlugin.getPlugin().setInvokeToString(invokeToStringButton.getSelection());
SDBGDebugCorePlugin.getPlugin().setUseSmartStepOver(useSmartStepOverButton.getSelection());
SDBGDebugCorePlugin.getPlugin().setUseSmartStepInOut(useSmartStepInOutButton.getSelection());
SDBGDebugCorePlugin.getPlugin().setExcludeFromLogicalStructure(
excludeFromLogicalStructureText.getText());

// SDBGDebugCorePlugin.getPlugin().setBrowserPreferences(
// defaultBrowserButton.getSelection(),
Expand Down Expand Up @@ -109,6 +113,14 @@ protected Control createContents(Composite parent) {
useSmartStepInOutButton.setText("Skip non-sourcemapped JavaScript frames when stepping-in and out");
GridDataFactory.swtDefaults().span(2, 1).applyTo(useSmartStepInOutButton);

Label excludeFromLogicalStructureLabel = new Label(group, SWT.NONE);
excludeFromLogicalStructureLabel.setText("Objects to exclude from Logical Structure (regexp):");
GridDataFactory.swtDefaults().span(2, 1).applyTo(excludeFromLogicalStructureLabel);

excludeFromLogicalStructureText = new Text(group, SWT.BORDER);
GridDataFactory.swtDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(
excludeFromLogicalStructureText);

// createBrowserConfig(composite, labelWidth);

initFromPrefs();
Expand Down Expand Up @@ -184,6 +196,7 @@ private void initFromPrefs() {
invokeToStringButton.setSelection(SDBGDebugCorePlugin.getPlugin().getInvokeToString());
useSmartStepOverButton.setSelection(SDBGDebugCorePlugin.getPlugin().getUseSmartStepOver());
useSmartStepInOutButton.setSelection(SDBGDebugCorePlugin.getPlugin().getUseSmartStepInOut());
excludeFromLogicalStructureText.setText(SDBGDebugCorePlugin.getPlugin().getExcludeFromLogicalStructure());
}
//
// private void setEnablement(boolean value) {
Expand Down
Expand Up @@ -14,6 +14,7 @@

package com.github.sdbg.integration.jdt.gwt;

import com.github.sdbg.debug.core.SDBGDebugCorePlugin;
import com.github.sdbg.debug.core.model.ISDBGLogicalStructureTypeExtensions;
import com.github.sdbg.debug.core.model.ISDBGValue;
import com.github.sdbg.debug.core.model.ISDBGVariable;
Expand All @@ -24,6 +25,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.regex.Pattern;

import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate;
Expand Down Expand Up @@ -134,7 +136,8 @@ public String getReferenceTypeName() throws DebugException {
// held in this variable gets converted to its logical representation, if we don't do it, some
// things which should be hidden may show through
String rawReferenceTypeName = super.getReferenceTypeName();
if (isJavaObject((ISDBGValue) getValue()) && hasGWTSuffix(rawReferenceTypeName)) {
if (!isExcludedFromLogicalStructure(getValue()) && isJavaObject((ISDBGValue) getValue())
&& hasGWTSuffix(rawReferenceTypeName)) {
return removeGWTSuffix(rawReferenceTypeName);
} else {
return rawReferenceTypeName;
Expand All @@ -153,7 +156,7 @@ public String getDescription(IValue value) {
@Override
public ISDBGValue getLogicalStructure(IValue value) throws DebugException {
ISDBGValue sValue = (ISDBGValue) value;
if (sValue instanceof GWTSDMValue) {
if (sValue instanceof GWTSDMValue || isExcludedFromLogicalStructure(sValue)) {
return sValue;
}

Expand Down Expand Up @@ -214,7 +217,8 @@ public boolean isValueDetailStringComputedByLogicalStructure(IValue value) throw

@Override
public boolean isValueStringComputedByLogicalStructure(IValue value) throws DebugException {
if (value instanceof ISDBGValue && !(value instanceof GWTSDMValue)) {
if (value instanceof ISDBGValue && !(value instanceof GWTSDMValue)
&& !isExcludedFromLogicalStructure(value)) {
ISDBGValue sval = (ISDBGValue) value;
return !sval.isScope() && (isJavaObject(sval) || getLong(sval) != null);
}
Expand All @@ -224,7 +228,13 @@ public boolean isValueStringComputedByLogicalStructure(IValue value) throws Debu

@Override
public boolean providesLogicalStructure(IValue value) {
return value instanceof ISDBGValue && !(value instanceof GWTSDMValue);
try {
return value instanceof ISDBGValue && !(value instanceof GWTSDMValue)
&& !isExcludedFromLogicalStructure(value);
} catch (DebugException e) {
SDBGDebugCorePlugin.logError(e);
return false;
}
}

// Returns all properties which look like Java fields of the supplied value
Expand Down Expand Up @@ -311,6 +321,20 @@ private boolean hasOwnProperty(IValue value, String property) throws DebugExcept
return getOwnProperty(value, property) != null;
}

private boolean isExcludedFromLogicalStructure(IValue value) throws DebugException {
if (!(value instanceof ISDBGValue)) {
return false;
}

String excludeFromLogicalStructureStr = SDBGDebugCorePlugin.getPlugin().getExcludeFromLogicalStructure();
if (excludeFromLogicalStructureStr != null
&& excludeFromLogicalStructureStr.trim().length() > 0) {
return Pattern.matches(excludeFromLogicalStructureStr, value.getReferenceTypeName());
} else {
return false;
}
}

private boolean isJavaClass(ISDBGValue value) throws DebugException {
return value.isObject() && hasOwnProperty(value, "___clazz$");
}
Expand Down

0 comments on commit a7734b4

Please sign in to comment.