Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2015-12-17 10:22:25 -0500
committerGerrit Code Review @ Eclipse.org2015-12-18 07:59:19 -0500
commit5218c3caf9a4401753e3733387cb40486b42dd62 (patch)
tree55459d0ed90cad985ae634999f8b2949ec9a7604 /codan
parent4f9dbedc0adf2587a15a753f0fd17e2ce90852b3 (diff)
downloadorg.eclipse.cdt-5218c3caf9a4401753e3733387cb40486b42dd62.tar.gz
org.eclipse.cdt-5218c3caf9a4401753e3733387cb40486b42dd62.tar.xz
org.eclipse.cdt-5218c3caf9a4401753e3733387cb40486b42dd62.zip
cleanup of ControlFlowGraph view
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cfgview/.settings/org.eclipse.jdt.core.prefs90
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cfgview/build.properties9
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/ControlFlowGraphPlugin.java52
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java111
4 files changed, 179 insertions, 83 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui.cfgview/.settings/org.eclipse.jdt.core.prefs b/codan/org.eclipse.cdt.codan.ui.cfgview/.settings/org.eclipse.jdt.core.prefs
index ba57a34139..91634d75b9 100644
--- a/codan/org.eclipse.cdt.codan.ui.cfgview/.settings/org.eclipse.jdt.core.prefs
+++ b/codan/org.eclipse.cdt.codan.ui.cfgview/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,98 @@
-#Wed Feb 23 19:44:14 EST 2011
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/codan/org.eclipse.cdt.codan.ui.cfgview/build.properties b/codan/org.eclipse.cdt.codan.ui.cfgview/build.properties
index b76eb0af39..1e8a52679b 100644
--- a/codan/org.eclipse.cdt.codan.ui.cfgview/build.properties
+++ b/codan/org.eclipse.cdt.codan.ui.cfgview/build.properties
@@ -9,10 +9,11 @@
# Alena Laskavaia - initial API and implementation
# IBM Corporation
###############################################################################source.. = src/
+source.. = src/
output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
+bin.includes = META-INF/,\
.,\
- icons/,\
- about.html
+ plugin.xml,\
+ about.html,\
+ icons/
src.includes = about.html
diff --git a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/ControlFlowGraphPlugin.java b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/ControlFlowGraphPlugin.java
index b6f7bde2e8..b2a6881f87 100644
--- a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/ControlFlowGraphPlugin.java
+++ b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/ControlFlowGraphPlugin.java
@@ -1,5 +1,8 @@
package org.eclipse.cdt.codan.ui.cfgview;
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
@@ -23,7 +26,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
@@ -36,7 +39,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
@@ -49,7 +52,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static ControlFlowGraphPlugin getDefault() {
@@ -59,7 +62,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
- *
+ *
* @param path the path
* @return the image descriptor
*/
@@ -83,4 +86,45 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
}
return image;
}
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status
+ * status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs an internal error with the specified throwable
+ *
+ * @param e the exception to be logged
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public static void log(Throwable e) {
+ log("Internal Error", e); //$NON-NLS-1$
+ }
+
+ /**
+ * Logs an internal error with the specified message and throwable
+ *
+ * @param message the error message to log
+ * @param e the exception to be logged
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public static void log(String message, Throwable e) {
+ log(new Status(IStatus.ERROR, CodanCorePlugin.PLUGIN_ID, 1, message, e));
+ }
+
+ /**
+ * Logs an internal error with the specified message.
+ *
+ * @param message the error message to log
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public static void log(String message) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, 1, message, null));
+ }
}
diff --git a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
index 6b722e4722..993bc7d279 100644
--- a/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
+++ b/codan/org.eclipse.cdt.codan.ui.cfgview/src/org/eclipse/cdt/codan/ui/cfgview/views/ControlFlowGraphView.java
@@ -18,12 +18,13 @@ import org.eclipse.cdt.codan.core.model.cfg.ISingleOutgoing;
import org.eclipse.cdt.codan.core.model.cfg.IStartNode;
import org.eclipse.cdt.codan.internal.core.cfg.AbstractBasicBlock;
import org.eclipse.cdt.codan.ui.cfgview.ControlFlowGraphPlugin;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
+
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -32,9 +33,7 @@ import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.internal.ui.util.EditorUtility;
import org.eclipse.cdt.ui.CDTUITools;
import org.eclipse.cdt.ui.text.SharedASTJob;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -47,9 +46,6 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -66,6 +62,7 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.DrillDownAdapter;
@@ -94,8 +91,8 @@ public class ControlFlowGraphView extends ViewPart {
public static final String ID = "org.eclipse.cdt.codan.ui.cfgview.views.ControlFlowGraphView";
private TreeViewer viewer;
private DrillDownAdapter drillDownAdapter;
- private Action action1;
- private Action doubleClickAction;
+ private Action actionSync;
+
class DeadNodes extends ArrayList<IBasicBlock> {
}
@@ -122,7 +119,7 @@ public class ControlFlowGraphView extends ViewPart {
@Override
public Object[] getChildren(Object parent) {
if (parent instanceof Collection) {
- return ((Collection) parent).toArray();
+ return ((Collection<?>) parent).toArray();
} else if (parent instanceof IControlFlowGraph) {
IControlFlowGraph cfg = (IControlFlowGraph) parent;
Collection<IBasicBlock> blocks = getFlat(cfg.getStartNode(), new ArrayList<IBasicBlock>());
@@ -269,12 +266,12 @@ public class ControlFlowGraphView extends ViewPart {
}
private void fillLocalPullDown(IMenuManager manager) {
- manager.add(action1);
+ manager.add(actionSync);
manager.add(new Separator());
}
private void fillContextMenu(IMenuManager manager) {
- manager.add(action1);
+ manager.add(actionSync);
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
// Other plug-ins can contribute there actions here
@@ -282,18 +279,18 @@ public class ControlFlowGraphView extends ViewPart {
}
private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(action1);
+ manager.add(actionSync);
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
}
private void makeActions() {
- action1 = new Action() {
+ actionSync = new Action() {
@Override
public void run() {
IEditorPart e = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(e.getEditorInput());
- Job job = new SharedASTJob("Job Name", tu) {
+ Job job = new SharedASTJob("Building Control Flow Grath", tu) {
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
processAst(ast);
@@ -303,35 +300,14 @@ public class ControlFlowGraphView extends ViewPart {
job.schedule();
}
};
- action1.setText("Synchronize");
- action1.setToolTipText("Synchronize");
- action1.setImageDescriptor(ControlFlowGraphPlugin.getDefault().getImageDescriptor("icons/refresh_view.gif"));
- doubleClickAction = new Action() {
- @Override
- public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- showMessage("Double-click detected on " + obj.toString());
- }
- };
- }
-
- private void hookDoubleClickAction() {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- doubleClickAction.run();
- }
- });
- }
-
- private void showMessage(String message) {
- MessageDialog.openInformation(viewer.getControl().getShell(), "Control Flow Graph", message);
+ actionSync.setText("Synchronize");
+ actionSync.setToolTipText("Synchronize");
+ actionSync.setImageDescriptor(ControlFlowGraphPlugin.getDefault().getImageDescriptor("icons/refresh_view.gif"));
}
protected void processAst(IASTTranslationUnit ast) {
final ArrayList<IControlFlowGraph> functions = new ArrayList<IControlFlowGraph>();
- CASTVisitor visitor = new CASTVisitor() {
+ ASTVisitor visitor = new ASTVisitor() {
{
shouldVisitDeclarations = true;
}
@@ -365,26 +341,23 @@ public class ControlFlowGraphView extends ViewPart {
}
private class ASTHighlighterAction extends Action {
- private static final String A_PART_INSTANCEOF = "aPart instanceof "; //$NON-NLS-1$
IEditorPart aPart = null;
public ASTHighlighterAction(IEditorPart part) {
this.aPart = part;
}
- public void setPart(IEditorPart part) {
- this.aPart = part;
- }
-
protected boolean open(String filename) throws PartInitException, CModelException {
- IPath path = new Path(filename);
- IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
- if (f != null) {
- EditorUtility.openInEditor(f);
- return true;
+ if (filename.equals(""))
+ return false;
+ IResource r = ParserUtil.getResourceForFilename(filename);
+ if (r != null) {
+ aPart = EditorUtility.openInEditor(r);
+ } else {
+ IPath path = new Path(filename);
+ FileStorage storage = new FileStorage(null, path);
+ aPart = EditorUtility.openInEditor(storage);
}
- FileStorage storage = new FileStorage(null, path);
- EditorUtility.openInEditor(storage);
return true;
}
@@ -400,32 +373,22 @@ public class ControlFlowGraphView extends ViewPart {
return;
IASTFileLocation loc = node.getFileLocation();
String filename = loc.getFileName();
- if (filename.equals(""))
- return;
- IResource r = ParserUtil.getResourceForFilename(filename);
- if (r != null) {
- try {
- aPart = EditorUtility.openInEditor(r);
- } catch (PartInitException pie) {
- return;
- } catch (CModelException e) {
- return;
- }
- } else {
- // IPath path = new Path(filename);
- // if (tu != null) {
- // try {
- // aPart = EditorUtility.openInEditor(path, tu);
- // } catch (PartInitException e) {
- // return;
- // }
- // }
+ try {
+ open(filename);
+ } catch (PartInitException e) {
+ ControlFlowGraphPlugin.log(e);
+ } catch (CModelException e) {
+ ControlFlowGraphPlugin.log(e);
}
+
if (aPart instanceof AbstractTextEditor) {
((AbstractTextEditor) aPart).selectAndReveal(loc.getNodeOffset(), loc.getNodeLength());
- } else
- System.out.println(A_PART_INSTANCEOF + aPart.getClass().getName());
- aPart.getSite().getPage().activate(aPart.getSite().getPage().findView(ID));
+ }
+ // re-activate view
+ if (aPart != null) {
+ IWorkbenchPage page = aPart.getSite().getPage();
+ page.activate(page.findView(ID));
+ }
}
}
}

Back to the top