diff options
author | jungwook.ryu <jungwook.ryu@samsung.com> | 2015-02-09 17:38:08 +0900 |
---|---|---|
committer | jungwook.ryu <jungwook.ryu@samsung.com> | 2015-04-09 11:35:41 +0900 |
commit | 54f091371a6655c2cf7e5d9d981a71f47d9f16e6 (patch) | |
tree | 1bd406cceea9306fe1e750eeb6e297a490a1fe4a | |
parent | b0fe678731b27c75bc248261ef1e22cbde45ec38 (diff) | |
download | dynamic-analysis-ide-eplugin-da-interactive.tar.gz dynamic-analysis-ide-eplugin-da-interactive.tar.bz2 dynamic-analysis-ide-eplugin-da-interactive.zip |
feature : 1. Reinforce logic about checking validation/management of Interactive Checkpointsda-interactive
2. Add UI to select Checkpoint location (Before/After line execution)
Change-Id: Id488cf5e03cd6793fa27e88d0534cb030ebf32ac
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
12 files changed, 648 insertions, 104 deletions
diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml b/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml index 54079dd..1ad5369 100755 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/plugin.xml @@ -125,9 +125,8 @@ </action> </viewerContribution> </extension> - <extension id="damarker" point="org.eclipse.core.resources.markers" /> - <extension id="interactivemarker" point="org.eclipse.core.resources.markers"> - <super type="org.tizen.dynamicanalysis.ide.eplugin.damarker"/> + <extension id="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker" point="org.eclipse.core.resources.markers"> + <super type="org.eclipse.core.resources.marker"/> <attribute name="variableName" /> <attribute name="sourcePath_" /> <attribute name="arrayCount" /> @@ -137,12 +136,18 @@ point="org.eclipse.ui.ide.markerSupport"> <markerContentGenerator id="org.tizen.dynamicanalysis.ide.eplugin.markerEventContentGenerator" name="My Marker Generator"> - <markerTypeReference id="org.tizen.dynamicanalysis.ide.eplugin.damarker"/> + <markerTypeReference id="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker"/> + <markerFieldReference id="org.eclipse.ui.ide.completionField"/> <markerFieldReference id="variableName"/> <markerFieldReference id="org.eclipse.ui.ide.resourceField"/> <markerFieldReference id="org.eclipse.ui.ide.locationField"/> </markerContentGenerator> <markerField + class="org.tizen.dynamicanalysis.ide.eplugin.views.CheckBoxField" + id="checkBox" + name="check"> + </markerField> + <markerField class="org.tizen.dynamicanalysis.ide.eplugin.views.VariableNameField" id="variableName" name="Variable Name"> @@ -154,7 +159,8 @@ category="org.tizen.nativeapp.viewCategory" class="org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView" id="org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView" - name="Interactive Profiling"> + name="Interactive Profiling" + icon="icon/alt_window_16.png"> </view> </extension> @@ -176,4 +182,34 @@ file="contexts.xml"> </contexts> </extension> + <extension + point="org.eclipse.ui.editors.markerAnnotationSpecification" + id="interactiveannotationspecification"> + <specification + annotationType="interactiveannotation" + colorPreferenceKey="clcolor" + colorPreferenceValue="255,255,0" + highlightPreferenceKey="clhighlight" + highlightPreferenceValue="false" + icon="icon/alt_window_16.png" + label="CheckPoint of Dynamic Analyzer" + overviewRulerPreferenceKey="clruler" + overviewRulerPreferenceValue="true" + textPreferenceKey="cltext" + textPreferenceValue="false" + textStylePreferenceKey="clstyle" + textStylePreferenceValue="NONE" + verticalRulerPreferenceKey="clvertical" + verticalRulerPreferenceValue="true"> + </specification> + </extension> + <extension + point="org.eclipse.ui.editors.annotationTypes"> + <type + markerSeverity="0" + markerType="org.tizen.dynamicanalysis.ide.eplugin.interactivemarker" + name="interactiveannotation" + super="org.eclipse.ui.workbench.texteditor.info"> + </type> + </extension> </plugin> diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java index 35db85c..67e01f9 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/Activator.java @@ -26,16 +26,47 @@ package org.tizen.dynamicanalysis.ide.eplugin; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.model.ILanguage; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.cdt.ui.CDTUITools; +import org.eclipse.cdt.ui.text.SharedASTJob; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup; +import org.tizen.dynamicanalysis.ide.eplugin.popup.actions.InteractiveUtil; public class Activator implements BundleActivator { public static final String PLUGIN_ID = "org.tizen.dynamicanalyzer";//$NON-NLS-1$ public static final String PROFILE_MODE = "profile";//$NON-NLS-1$ - + public static final Object InteractiveValidCheckJobLock = new Object(); + private static BundleContext context; + private IResourceChangeListener listener; + static BundleContext getContext() { return context; } @@ -46,6 +77,98 @@ public class Activator implements BundleActivator { */ public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + listener = new IResourceChangeListener() { + @Override + public void resourceChanged(IResourceChangeEvent event) { + switch (event.getType()) { + /* + * Listen Save Event + * This routine again check validation of Interactive Markers. + */ + case IResourceChangeEvent.POST_CHANGE : + final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); + final Map<IEditorPart, IMarker[]> editorMap = new HashMap<IEditorPart, IMarker[]>(); + try { + /* + * Find changed resources and collect all markers contained in changed resources. + * Also IEditorPart is collected to get Source code parser and check isDirty. + */ + event.getDelta().accept(new IResourceDeltaVisitor() { + @Override + public boolean visit(IResourceDelta delta) throws CoreException { + if (delta.getKind() == IResourceDelta.CHANGED) { + IEditorInput editorInput = InteractiveUtil.getEditorInput(delta.getResource()); + if (editorInput != null) { + for (int i = 0; i < windows.length; i++) { + IWorkbenchPage[] pages = windows[i].getPages(); + for (int j = 0; j < pages.length; j++) { + IEditorPart editor = pages[j].findEditor(editorInput); + if (editor != null) { + IMarker[] markers = delta.getResource().findMarkers( + CommonConstants.MARKER_ID, true, 1); + editorMap.put(editor, markers); + } + } + } + } + } + return true; + } + }); + } catch (CoreException e) { + DALog.printLog(e); + } + + Iterator<IEditorPart> iter = editorMap.keySet().iterator(); + while (iter.hasNext()) { + final IEditorPart editorPart = iter.next(); + final IMarker[] markerList = editorMap.get(editorPart); + ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(editorPart.getEditorInput()); + if (tu == null) { + continue; + } + // Check validation + Job job = new SharedASTJob(CommonConstants.INTERACTIVE_VALIDATION_JOB_NAME, tu) { + @Override + public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException { + IASTNodeSelector nodeSelector = ast.getNodeSelector(null); + synchronized(InteractiveValidCheckJobLock) { + // Before markers update, listener should be removed to prevent recursive event occurs. + workspace.removeResourceChangeListener(listener); + for (int i = 0; i < markerList.length; i++) { + IMarker marker = markerList[i]; + Object offset = marker.getAttribute(IMarker.CHAR_START); + if (offset != null) { + IASTName name = nodeSelector.findEnclosingName((Integer)offset, 0); + if (editorPart.isDirty()) { + // user edit source file during save handling. + break; + } + boolean isValid = InteractiveUtil.isValidVariable(name); + if (isValid) { + marker.setAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, + InteractiveUtil.makeFullVariableName(name)); + } + marker.setAttribute(CommonConstants.MARKER_VALID_VARIABLE, isValid); + } + } + // After markers update, listener should be set again. + workspace.addResourceChangeListener(listener); + } + + return Status.OK_STATUS; + } + }; + job.schedule(); + } + break; + default: + break; + } + } + }; + workspace.addResourceChangeListener(listener); } /* diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java index ac5a0eb..d30ca95 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/CommonConstants.java @@ -32,4 +32,12 @@ public class CommonConstants { public static final String MARKER_ATTR_VARIABLE_NAME = "variableName"; public static final String MARKER_ATTR_SOURCE_PATH = "sourcePath"; public static final String MARKER_ATTR_ARRAY_COUNT = "arrayCount"; + public static final String MARKER_ATTR_CHECK_LOCATION = "checkLocation"; + public static final String MARKER_VALID_VARIABLE = "isValid"; + public static final String INTERACTIVE_VALIDATION_JOB_NAME = "Check validation of interactive checkpoint"; + + public static final int INTERACTIVE_CHECKPOINT_LOCATION_INVALID = 0; + public static final int INTERACTIVE_CHECKPOINT_LOCATION_BEFORE = 1; + public static final int INTERACTIVE_CHECKPOINT_LOCATION_AFTER = 2; + public static final int INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_AFTER = 3; }
\ No newline at end of file diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java index ec608f2..4f97a90 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java @@ -365,6 +365,7 @@ public class DAServerManager extends Thread { command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getVariableName()); command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getLine()); command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getArrayCount()); + command.append(IDE_DA_COMMUNICATION_SEPARATOR).append(info.getCheckLocation()); } } try { diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java index 27c3cd1..c726721 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/CheckPointInfo.java @@ -31,12 +31,14 @@ public class CheckPointInfo { private String variableName; private int line; private int arrayCount; + private int checkLocation; - public CheckPointInfo(String sourcePath, String variableName, int line, int arrayCount) { + public CheckPointInfo(String sourcePath, String variableName, int line, int arrayCount, int checkLocation) { this.sourcePath = sourcePath; this.variableName = variableName; this.line = line; this.arrayCount = arrayCount; + this.checkLocation = checkLocation; } public String getSourcePath() { @@ -55,6 +57,10 @@ public class CheckPointInfo { return arrayCount; } + public int getCheckLocation() { + return checkLocation; + } + private String getStream() { return variableName + "," + line + "," + sourcePath; } diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java index 41f0572..5694edb 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/launch/TizenNativeApplicationDADelegate.java @@ -40,7 +40,6 @@ import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -58,10 +57,6 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.FileEditorInput; import org.tizen.common.IApplicationConfiguration; import org.tizen.common.core.application.InstallPathConfig; import org.tizen.common.launch.LaunchMessages; @@ -184,26 +179,30 @@ public class TizenNativeApplicationDADelegate extends TizenLaunchDelegate { } } - private Set<CheckPointInfo> getProfileVariableInfos(IProject project, ILaunchConfiguration config) { + private Set<CheckPointInfo> getProfileVariableInfos(final IProject project, ILaunchConfiguration config) { final Set<CheckPointInfo> profileVariableInfos = new HashSet<CheckPointInfo>(); Display.getDefault().syncExec(new Runnable() { @Override public void run() { - IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - IEditorInput input = part.getEditorInput(); - IFile file = ((FileEditorInput) input).getFile(); try { - IMarker[] markers = file.findMarkers(CommonConstants.MARKER_ID, true, IResource.DEPTH_INFINITE); - for (int i = 0; i < markers.length; i++) { - String sourcePath = markers[i].getAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, ""); - String variableName = markers[i].getAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, ""); - int line = markers[i].getAttribute(IMarker.LINE_NUMBER, 0); - int arrayCount = markers[i].getAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, 0); - CheckPointInfo info = new CheckPointInfo(sourcePath, variableName, line, arrayCount); - profileVariableInfos.add(info); + IMarker[] markers = project.findMarkers(CommonConstants.MARKER_ID, true, IResource.DEPTH_INFINITE); + synchronized(Activator.InteractiveValidCheckJobLock) { + for (int i = 0; i < markers.length; i++) { + boolean isChecked = (Boolean)markers[i].getAttribute(IMarker.DONE); + boolean isValid = (Boolean)markers[i].getAttribute(CommonConstants.MARKER_VALID_VARIABLE); + if (isChecked && isValid) { + String sourcePath = markers[i].getAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, ""); + String variableName = markers[i].getAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, ""); + int line = markers[i].getAttribute(IMarker.LINE_NUMBER, 0); + int arrayCount = markers[i].getAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, 0); + int checkLocation = markers[i].getAttribute(CommonConstants.MARKER_ATTR_CHECK_LOCATION, 0); + CheckPointInfo info = new CheckPointInfo(sourcePath, variableName, line, arrayCount, checkLocation); + profileVariableInfos.add(info); + } + } } } catch (CoreException e) { - e.printStackTrace(); + DALog.printLog(e); } } }); diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java index 443b619..b2d7996 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.java @@ -45,6 +45,17 @@ public class Labels extends NLS { public static String MESSAGE_ANOTHER_IDE_CONNECTED; + public static String INTERACTIVE_DIALOG_TITLE_SUCCESS; + public static String INTERACTIVE_DIALOG_MSG_SUCCESS; + public static String INTERACTIVE_DIALOG_TITLE_ERROR; + public static String INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE; + public static String INTERACTIVE_DIALOG_MSG_INVALID_LINE; + + public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE; + public static String INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION; + public static String INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION; + public static String INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Labels.class); diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties index feec3f8..6e69506 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/nl/Labels.properties @@ -10,4 +10,16 @@ MESSAGE_DYNAMIC_ANALYZER_IS_NOT_INSTALLED=Dynamic Analyzer is not installed. MESSAGE_NOT_SUPPORT_UNIT_TEST_PROJECT=DA does not support tizen unit test project. MESSAGE_NOT_SUPPORT_IME_PROJECT=Certain application categories, such as "ime", cannot be launched by "Profile As". -MESSAGE_ANOTHER_IDE_CONNECTED= Dynamic Analyzer has been connected to another IDE\n You need to close the prior Dynamic Analyzer first.
\ No newline at end of file +MESSAGE_ANOTHER_IDE_CONNECTED= Dynamic Analyzer has been connected to another IDE\n You need to close the prior Dynamic Analyzer first. + +INTERACTIVE_DIALOG_TITLE_SUCCESS=Checkpoint is added successfully +INTERACTIVE_DIALOG_MSG_SUCCESS=Variable is added to Checkpoint successfully. +INTERACTIVE_DIALOG_TITLE_ERROR=Checkpoint is failed to be added +INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE=Invalid variable. The word you selected is not variable.\nYou should select a variable. +INTERACTIVE_DIALOG_MSG_INVALID_LINE=Invalid line. This line is not in function.\nYou should select line which belongs to function body. + +INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE=Select location of CheckPoint +INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION=To use interactive profiling, you should select at least one location of CheckPoint.\nTo get value before execution of the line you selected, you should check "Before line execution".\nOr if you want to get value after execution of the line, check "After line execution". + +INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION=Before line execution +INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION=After line execution
\ No newline at end of file diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java index e0d20e2..4bee210 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/AddProfileVariableActionDelegate.java @@ -25,15 +25,11 @@ package org.tizen.dynamicanalysis.ide.eplugin.popup.actions; -import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTFieldReference; -import org.eclipse.cdt.core.dom.ast.IASTIdExpression; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ITranslationUnit; @@ -47,9 +43,11 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.ui.IEditorActionDelegate; @@ -59,14 +57,13 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionDelegate; import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.texteditor.IDocumentProvider; import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; +import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels; import org.tizen.dynamicanalysis.ide.eplugin.views.InteractiveProfileView; public class AddProfileVariableActionDelegate extends ActionDelegate implements IEditorActionDelegate { - private static final String DIALOG_MSG_SUCCESS = "Success to add variable to Checkpoint."; - private static final String DIALOG_MSG_INVALID_VARIABLE = "Invalid variable."; - private static final String AST_JOB_NAME = "Get selected binding"; - /** * @see ActionDelegate#run(IAction) */ @@ -74,17 +71,27 @@ public class AddProfileVariableActionDelegate extends ActionDelegate implements public void run(IAction action) { IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (part instanceof ICEditor) { - ICEditor editor = (ICEditor) part; + final ICEditor editor = (ICEditor) part; IEditorInput input = editor.getEditorInput(); final IFile file = ((FileEditorInput) input).getFile(); ISelection sel = editor.getSelectionProvider().getSelection(); if (sel instanceof TextSelection) { final ITextSelection textSel = (ITextSelection) sel; ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(part.getEditorInput()); + IDocumentProvider prov = editor.getDocumentProvider(); + IDocument doc = prov.getDocument(editor.getEditorInput()); + /* + * Check valid line + */ + int lineNum = textSel.getStartLine() + 1; + if (InteractiveUtil.isValidLine(tu, lineNum, textSel.getOffset(), doc) == false) { + notifyInvalidLine(); + return; + } /* * Check validation */ - Job job = new SharedASTJob(AST_JOB_NAME, tu) { + Job job = new SharedASTJob(CommonConstants.INTERACTIVE_VALIDATION_JOB_NAME, tu) { @Override public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException { IASTNodeSelector nodeSelector = ast.getNodeSelector(null); @@ -99,8 +106,11 @@ public class AddProfileVariableActionDelegate extends ActionDelegate implements arrayCount = ((IArrayType) (((IVariable) b).getType())).getSize().numericalValue() .intValue(); } - String fullName = makeFullVariableName(name); - setInteractiveInfo(fullName, arrayCount, textSel, file); + int line = textSel.getStartLine() + 1; // getStartLine() return index. so plus 1. + int offset = textSel.getOffset(); + int length = name.toString().length(); + String fullName = InteractiveUtil.makeFullVariableName(name); + setInteractiveInfo(fullName, arrayCount, line, offset, length, file); } } else { notifyInvalidVariable(); @@ -113,60 +123,50 @@ public class AddProfileVariableActionDelegate extends ActionDelegate implements } } - /* - * If checkpoint's variable is member of structure, make string with (-> or .) - * ex) Input target is "memberVal", OutPut string is "structVal->memberVal". - */ - private String makeFullVariableName(IASTName target) { - String fullName = target.toString(); - if (target.getCompletionContext() == null || !(target.getCompletionContext() instanceof IASTExpression)) { - return fullName; - } - IASTExpression cursor = (IASTExpression)target.getCompletionContext(); - if (cursor != null && cursor instanceof IASTFieldReference) { - cursor = ((IASTFieldReference)cursor).getFieldOwner(); - while ((cursor != null)) { - if (cursor instanceof IASTFieldReference) { - if (cursor.getExpressionType() instanceof IPointerType) { - fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "->" + fullName; - } else { - fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "." + fullName; - } - cursor = ((IASTFieldReference)cursor).getFieldOwner(); - } else if (cursor instanceof IASTIdExpression) { - if (cursor.getExpressionType() instanceof IPointerType) { - fullName = ((IASTIdExpression)cursor).getName().toString() + "->" + fullName; - } else { - fullName = ((IASTIdExpression)cursor).getName().toString() + "." + fullName; + private void setInteractiveInfo(final String varName, final int arrayCount, final int line, final int offset, + int length, final IFile file) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + try { + InteractiveProfileView view = (InteractiveProfileView) PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().showView(CommonConstants.INTERACTIVE_VIEW_ID); + view.showBusy(true); + } catch (PartInitException e) { + DALog.printLog(e); + } + + SelectCheckpointDialog selectCheckPointDialog = new SelectCheckpointDialog(PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getShell()); + int checkLocation = selectCheckPointDialog.getLocation(); + if (checkLocation != CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_INVALID) { + // Create new marker + try { + IMarker marker = file.createMarker(CommonConstants.MARKER_ID); + if (marker != null) { + marker.setAttribute(IMarker.LINE_NUMBER, line); + marker.setAttribute(IMarker.CHAR_START, offset); + marker.setAttribute(IMarker.CHAR_END, offset); + marker.setAttribute(IMarker.USER_EDITABLE, true); + marker.setAttribute(IMarker.DONE, true); // Enable interactive + marker.setAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, varName); + marker.setAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, file.getLocation().toOSString()); + marker.setAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, arrayCount); + marker.setAttribute(CommonConstants.MARKER_ATTR_CHECK_LOCATION, checkLocation); + marker.setAttribute(CommonConstants.MARKER_VALID_VARIABLE, true); + } + } catch (CoreException e) { + DALog.printLog(e); } - break; - } else { - break; + + MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); + box.setText(Labels.INTERACTIVE_DIALOG_TITLE_SUCCESS); + box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_SUCCESS); + box.open(); } } - } - return fullName; - } - - private void setInteractiveInfo(String varName, int arrayCount, ITextSelection textSel, IFile file) { - try { - /* - * Create new marker - */ - IMarker marker = file.createMarker(CommonConstants.MARKER_ID); - if (marker != null) { - marker.setAttribute(CommonConstants.MARKER_ATTR_VARIABLE_NAME, varName); - marker.setAttribute(CommonConstants.MARKER_ATTR_SOURCE_PATH, file.getLocation().toOSString()); - // getStartLine() return index. so plus 1. - marker.setAttribute(IMarker.LINE_NUMBER, textSel.getStartLine() + 1); - marker.setAttribute(IMarker.CHAR_START, textSel.getOffset()); - marker.setAttribute(IMarker.CHAR_END, textSel.getOffset() + varName.length()); - marker.setAttribute(CommonConstants.MARKER_ATTR_ARRAY_COUNT, arrayCount); - } - notifySucess(); - } catch (CoreException e) { - e.printStackTrace(); - } + }); + } /** @@ -180,27 +180,23 @@ public class AddProfileVariableActionDelegate extends ActionDelegate implements Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - box.setMessage(DIALOG_MSG_INVALID_VARIABLE); + MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + SWT.ICON_ERROR); + box.setText(Labels.INTERACTIVE_DIALOG_TITLE_ERROR); + box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_INVALID_VARIABLE); box.open(); } }); } - private void notifySucess() { + private void notifyInvalidLine() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - try { - InteractiveProfileView view = (InteractiveProfileView) PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage() - .showView(CommonConstants.INTERACTIVE_VIEW_ID); - view.showBusy(true); - } catch (PartInitException e) { - e.printStackTrace(); - } - MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - box.setMessage(DIALOG_MSG_SUCCESS); + MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + SWT.ICON_ERROR); + box.setText(Labels.INTERACTIVE_DIALOG_TITLE_ERROR); + box.setMessage(Labels.INTERACTIVE_DIALOG_MSG_INVALID_LINE); box.open(); } }); diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java new file mode 100644 index 0000000..1586ad1 --- /dev/null +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/InteractiveUtil.java @@ -0,0 +1,142 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Jungwook Ryu <jungwook.ryu@samsung.com> + * Juyoung Kim <j0.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.dynamicanalysis.ide.eplugin.popup.actions; + +import org.eclipse.cdt.core.dom.ast.IASTExpression; +import org.eclipse.cdt.core.dom.ast.IASTFieldReference; +import org.eclipse.cdt.core.dom.ast.IASTIdExpression; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IPointerType; +import org.eclipse.cdt.core.dom.ast.IVariable; +import org.eclipse.cdt.core.model.CModelException; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ISourceRange; +import org.eclipse.cdt.core.model.ISourceReference; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.part.FileEditorInput; +import org.tizen.dynamicanalysis.ide.eplugin.DALog; + +public class InteractiveUtil { + private static final int NOT_EXIST = -1; + + public static IEditorInput getEditorInput(IResource resource){ + if (resource instanceof IFile) { + return new FileEditorInput((IFile)resource); + } + return null; + } + + public static boolean isValidVariable(IASTName name) { + if (name != null) { + IBinding b = name.resolveBinding(); + if (b != null && (b instanceof IVariable)) { + return true; + } + } + return false; + } + + public static boolean isValidLine(ITranslationUnit tu, int line, int offset, IDocument doc) { + try { + ICElement[] celements = tu.getChildren(); + for (ICElement celement : celements) { + ISourceRange range = ((ISourceReference)celement).getSourceRange(); + int startLine = range.getStartLine(); + int endLine = range.getEndLine(); + if (line >= startLine && line <= endLine) { + if (celement.getElementType() == ICElement.C_FUNCTION) { + int functionBodyStartOffset = findFunctionBodyStartOffset(range.getStartPos(), doc); + if (functionBodyStartOffset == NOT_EXIST || offset <= functionBodyStartOffset) { + return false; + } + return true; + } else { + return false; + } + } + } + } catch (CModelException e) { + DALog.printLog(e); + } + return false; + } + + /* + * If checkpoint's variable is member of structure, make string with (-> or .) + * ex) Input target is "memberVal", OutPut string is "structVal->memberVal". + */ + public static String makeFullVariableName(IASTName target) { + String fullName = target.toString(); + if (target.getCompletionContext() == null || !(target.getCompletionContext() instanceof IASTExpression)) { + return fullName; + } + IASTExpression cursor = (IASTExpression)target.getCompletionContext(); + if (cursor != null && cursor instanceof IASTFieldReference) { + cursor = ((IASTFieldReference)cursor).getFieldOwner(); + while ((cursor != null)) { + if (cursor instanceof IASTFieldReference) { + if (cursor.getExpressionType() instanceof IPointerType) { + fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "->" + fullName; + } else { + fullName = ((IASTFieldReference)cursor).getFieldName().toString() + "." + fullName; + } + cursor = ((IASTFieldReference)cursor).getFieldOwner(); + } else if (cursor instanceof IASTIdExpression) { + if (cursor.getExpressionType() instanceof IPointerType) { + fullName = ((IASTIdExpression)cursor).getName().toString() + "->" + fullName; + } else { + fullName = ((IASTIdExpression)cursor).getName().toString() + "." + fullName; + } + break; + } else { + break; + } + } + } + return fullName; + } + + private static int findFunctionBodyStartOffset(int functionStartOffset, IDocument doc) { + int cursorOffset = functionStartOffset; + while (cursorOffset < doc.getLength()) { + try { + if (doc.getChar(cursorOffset) == '{') { + return cursorOffset; + } + cursorOffset++; + } catch (BadLocationException e) { + DALog.printLog(e); + } + } + return NOT_EXIST; + } +} diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java new file mode 100644 index 0000000..a1bf745 --- /dev/null +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/popup/actions/SelectCheckpointDialog.java @@ -0,0 +1,190 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Jungwook Ryu <jungwook.ryu@samsung.com> + * Juyoung Kim <j0.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.dynamicanalysis.ide.eplugin.popup.actions; + +import java.util.ArrayList; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.SelectionDialog; +import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants; +import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels; + +/* + * This class is made reference by "org.eclipse.ui.dialogs.ListSelectionDialog.java". + */ +public class SelectCheckpointDialog extends SelectionDialog { + + private static class CheckPointColumn { + String description; + int code; + CheckPointColumn(String description, int code) { + this.description = description; + this.code = code; + } + @Override + public String toString() { + return description; + } + } + + private static final CheckPointColumn[] inputElement = { + new CheckPointColumn(Labels.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_DESCRIPTION, + CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE), + new CheckPointColumn(Labels.INTERACTIVE_CHECKPOINT_LOCATION_AFTER_DESCRIPTION, + CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_AFTER) }; + + // providers for populating this dialog + private ILabelProvider labelProvider; + + private IStructuredContentProvider contentProvider; + + // the visual selection widget group + CheckboxTableViewer listViewer; + + // sizing constants + private final static int SIZING_SELECTION_WIDGET_HEIGHT = 50; + private final static int SIZING_SELECTION_WIDGET_WIDTH = 350; + + public SelectCheckpointDialog(Shell parentShell) { + this(parentShell, inputElement, ArrayContentProvider.getInstance(), new LabelProvider(), + Labels.INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_DESCRITPION); + } + + public SelectCheckpointDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, + ILabelProvider labelProvider, String message) { + super(parentShell); + setTitle(Labels.INTERACTIVE_CHECKPOINT_LOCATION_DIALOG_TITLE); + this.contentProvider = contentProvider; + this.labelProvider = labelProvider; + setMessage(message); + } + + public int getLocation() { + setHelpAvailable(false); + int resultCode = open(); // dialog open + if (resultCode == SelectionDialog.OK) { + Object[] checkedElements = getResult(); + if (checkedElements.length == 2) { + return CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_BEFORE_AFTER; + } else { + return ((CheckPointColumn)(checkedElements[0])).code; + } + } + return CommonConstants.INTERACTIVE_CHECKPOINT_LOCATION_INVALID; + } + + @Override + protected Control createDialogArea(Composite parent) { + // page group + Composite composite = (Composite) super.createDialogArea(parent); + + initializeDialogUnits(composite); + + createMessageArea(composite); + + listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.Deactivate); + GridData data = new GridData(GridData.FILL_BOTH); + data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; + data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; + listViewer.getTable().setLayoutData(data); + + listViewer.setLabelProvider(labelProvider); + listViewer.setContentProvider(contentProvider); + + initializeViewer(); + + Dialog.applyDialogFont(composite); + + return composite; + } + + private void initializeViewer() { + listViewer.setInput(inputElement); + listViewer.addCheckStateListener(new ICheckStateListener() { + @Override + public void checkStateChanged(CheckStateChangedEvent event) { + listViewer.getTable().deselectAll(); + Object[] checkedElements = listViewer.getCheckedElements(); + if (checkedElements == null || checkedElements.length == 0) { + SelectCheckpointDialog.this.getOkButton().setEnabled(false); + } else { + SelectCheckpointDialog.this.getOkButton().setEnabled(true); + } + } + }); + listViewer.getTable().addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + listViewer.getTable().deselectAll(); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + listViewer.getTable().deselectAll(); + } + }); + } + + @Override + protected void okPressed() { + // Get the input children. + Object[] children = contentProvider.getElements(inputElement); + + // Build a list of selected children. + if (children != null) { + ArrayList list = new ArrayList(); + for (int i = 0; i < children.length; ++i) { + Object element = children[i]; + if (listViewer.getChecked(element)) { + list.add(element); + } + } + setResult(list); + } + + super.okPressed(); + } + + @Override + protected Control createContents(Composite parent) { + Composite composite = (Composite) super.createContents(parent); + getOkButton().setEnabled(false); + return composite; + } +} diff --git a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java index 8331d82..29c28d4 100644 --- a/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java +++ b/org.tizen.dynamicanalysis.ide.native.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/views/VariableNameField.java @@ -25,20 +25,40 @@ package org.tizen.dynamicanalysis.ide.eplugin.views; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities; import org.eclipse.ui.views.markers.MarkerField; import org.eclipse.ui.views.markers.MarkerItem; import org.tizen.dynamicanalysis.ide.eplugin.CommonConstants; public class VariableNameField extends MarkerField{ - + // If this name is shown, It's error situation. + private final static String INVALID_VARIABLE_NAME = "-"; + @Override public String getValue(MarkerItem item) { - return item.getAttributeValue(CommonConstants.MARKER_ATTR_VARIABLE_NAME, "-"); + return item.getAttributeValue(CommonConstants.MARKER_ATTR_VARIABLE_NAME, INVALID_VARIABLE_NAME); } @Override public int getDefaultColumnWidth(final Control control) { return 300; } + + @Override + public void update(ViewerCell cell) { + super.update(cell); + MarkerItem item = (MarkerItem) cell.getElement(); + cell.setImage(annotateImage(item, getImage(item))); + } + + private Image getImage(MarkerItem item) { + if (item.getAttributeValue(CommonConstants.MARKER_VALID_VARIABLE, false) == false) { + return MarkerSupportInternalUtilities.getSeverityImage(2); // Error image is shown to user. + } else { + return null; + } + } } |