Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java185
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java6
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java176
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModelTracker.java4
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java36
-rw-r--r--gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/GprofLaunchTest.java14
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/DevHelpPlugin.java286
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java896
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/FuncFoundSaxException.java8
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/BaseUITestCase.java110
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/CProjectHelper.java166
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ContentAssistTests.java190
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ResourceHelper.java104
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java20
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java26
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java2
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/Messages.java16
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java8
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java18
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java20
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java2
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java8
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/AbstractSaveDataHandler.java24
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/Messages.java16
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java10
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfDoubleClickAction.java2
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java8
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java426
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseAllTreeAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STDataViewersSortAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandAllTreeAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExportToCSVAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STHideShowColAction.java4
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java36
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java28
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java2
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProxyLaunchMessages.java16
-rwxr-xr-xprofiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ui/FileSystemSelectionArea.java2
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/CProjectBuildHelpers.java924
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/ProfileUIUtils.java62
-rw-r--r--profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTProxyManager.java12
-rw-r--r--profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/Messages.java70
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/Messages.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java2
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java12
-rw-r--r--rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java22
-rw-r--r--rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java87
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java3
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindParserUtils.java2
56 files changed, 2082 insertions, 2081 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
index 269a377944..40376466ea 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
@@ -57,9 +57,9 @@ public class CovManager implements Serializable {
*
*/
private static final long serialVersionUID = 5582066617970911413L;
-
+
private static String winOSType = ""; //$NON-NLS-1$
-
+
// input
private final String binaryPath;
// results
@@ -93,10 +93,8 @@ public class CovManager implements Serializable {
/**
* parse coverage files, execute resolve graph algorithm, process counts for functions, lines and folders.
- * @param List
- * of coverage files paths
- * @throws CoreException
- * , IOException, InterruptedException
+ * @param List of coverage files paths
+ * @throws CoreException, IOException, InterruptedException
*/
public void processCovFiles(List<String> covFilesPaths, String initialGcda) throws CoreException, IOException {
@@ -144,8 +142,9 @@ public class CovManager implements Serializable {
// parse GCDA file
traceFile = openTraceFileStream(gcdaPath, ".gcda", sourcePath); //$NON-NLS-1$
- if (traceFile == null)
+ if (traceFile == null) {
return;
+ }
if (noRcrd.getFnctns().isEmpty()) {
String message = NLS.bind(Messages.CovManager_No_Funcs_Error, gcnoPath);
Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message);
@@ -161,8 +160,9 @@ public class CovManager implements Serializable {
}
// to fill the view title
- if (daRcrd != null)
- nbrPgmRuns = daRcrd.getPgmSmryNbrPgmRuns();
+ if (daRcrd != null) {
+ nbrPgmRuns = daRcrd.getPgmSmryNbrPgmRuns();
+ }
/* process counts from data parsed */
@@ -192,8 +192,9 @@ public class CovManager implements Serializable {
for (SourceFile sf : allSrcs) {
File srcFile = new File(sf.getName());
String folderName = srcFile.getParent();
- if (folderName == null)
+ if (folderName == null) {
folderName = "?"; //$NON-NLS-1$
+ }
Folder folder = null;
for (Folder f : allFolders) {
if (f.getPath().equals(folderName)) {
@@ -215,8 +216,7 @@ public class CovManager implements Serializable {
/**
* fill the model by count results
- * @throws CoreException
- * , IOException, InterruptedException
+ * @throws CoreException, IOException, InterruptedException
*/
public void fillGcovView() {
@@ -258,96 +258,97 @@ public class CovManager implements Serializable {
// Get the Windows OS Type. We might have to change a path over to Windows format
// and this is different on Cygwin vs MingW.
private String getWinOSType() {
- if (winOSType.equals("")) { //$NON-NLS-1$
- try {
- Process process = Runtime.getRuntime().exec(new String[] {"sh", "-c", "echo $OSTYPE"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- @SuppressWarnings("resource")
- BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getInputStream()));
- String firstLine = null;
- try {
- firstLine = stdout.readLine();
- } finally {
- stdout.close();
- }
- if (firstLine != null)
- winOSType = firstLine.trim();
- } catch (IOException e) {
- // ignore
- }
- }
- return winOSType;
+ if (winOSType.equals("")) { //$NON-NLS-1$
+ try {
+ Process process = Runtime.getRuntime().exec(new String[] {"sh", "-c", "echo $OSTYPE"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ @SuppressWarnings("resource")
+ BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String firstLine = null;
+ try {
+ firstLine = stdout.readLine();
+ } finally {
+ stdout.close();
+ }
+ if (firstLine != null) {
+ winOSType = firstLine.trim();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ return winOSType;
}
// Get the OS path string. For Cygwin, translate We add a Win check to handle MingW.
// For MingW, we would rather represent C:\a\b as /C/a/b which
// doesn't cause Makefile to choke. For Cygwin we use /cygdrive/C/a/b
private String getTransformedPathString(IPath path) {
- String s = path.toOSString();
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- if (getWinOSType().equals("cygwin")) { //$NON-NLS-1$
- s = s.replaceAll("^\\\\cygdrive\\\\([a-zA-Z])", "$1:"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- s = s.replaceAll("^\\\\([a-zA-Z])", "$1:"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return s;
+ String s = path.toOSString();
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ if (getWinOSType().equals("cygwin")) { //$NON-NLS-1$
+ s = s.replaceAll("^\\\\cygdrive\\\\([a-zA-Z])", "$1:"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ s = s.replaceAll("^\\\\([a-zA-Z])", "$1:"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return s;
}
// transform String path to stream
private DataInput openTraceFileStream(String filePath, String extension, Map<File, File> sourcePath)
- throws FileNotFoundException {
- Path p = new Path(filePath);
- // get the file path transformed to work on local OS (e.g. Windows)
- filePath = getTransformedPathString(p);
- File f = new File(filePath).getAbsoluteFile();
- String filename = f.getName();
- if (f.isFile() && f.canRead()) {
- FileInputStream fis = new FileInputStream(f);
- InputStream inputStream = new BufferedInputStream(fis);
- return new DataInputStream(inputStream);
- } else {
- String postfix = ""; //$NON-NLS-1$
- File dir = null;
- do {
- if (postfix.isEmpty()) {
- postfix = f.getName();
- } else {
- postfix = f.getName() + File.separator + postfix;
- }
- f = f.getParentFile();
- if (f != null) {
- dir = sourcePath.get(f);
- } else {
- break;
- }
- } while (dir == null);
-
- if (dir != null) {
- f = new File(dir, postfix);
- if (f.isFile() && f.canRead()) {
- return openTraceFileStream(f.getAbsolutePath(), extension, sourcePath);
- }
- }
-
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- FileDialog fg = new FileDialog(shell, SWT.OPEN);
- fg.setFilterExtensions(new String[] { "*" + extension, "*.*", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fg.setFileName(filename);
- fg.setText(NLS.bind(Messages.CovManager_No_FilePath_Error, new Object[] { filePath, filename }));
- String s = fg.open();
- if (s == null) {
- return null;
- } else {
- f = new File(s).getAbsoluteFile();
- addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile());
- if (f.isFile() && f.canRead()) {
- FileInputStream fis = new FileInputStream(f);
- InputStream inputStream = new BufferedInputStream(fis);
- return new DataInputStream(inputStream);
- }
- }
- }
- return null;
+ throws FileNotFoundException {
+ Path p = new Path(filePath);
+ // get the file path transformed to work on local OS (e.g. Windows)
+ filePath = getTransformedPathString(p);
+ File f = new File(filePath).getAbsoluteFile();
+ String filename = f.getName();
+ if (f.isFile() && f.canRead()) {
+ FileInputStream fis = new FileInputStream(f);
+ InputStream inputStream = new BufferedInputStream(fis);
+ return new DataInputStream(inputStream);
+ } else {
+ String postfix = ""; //$NON-NLS-1$
+ File dir = null;
+ do {
+ if (postfix.isEmpty()) {
+ postfix = f.getName();
+ } else {
+ postfix = f.getName() + File.separator + postfix;
+ }
+ f = f.getParentFile();
+ if (f != null) {
+ dir = sourcePath.get(f);
+ } else {
+ break;
+ }
+ } while (dir == null);
+
+ if (dir != null) {
+ f = new File(dir, postfix);
+ if (f.isFile() && f.canRead()) {
+ return openTraceFileStream(f.getAbsolutePath(), extension, sourcePath);
+ }
+ }
+
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ FileDialog fg = new FileDialog(shell, SWT.OPEN);
+ fg.setFilterExtensions(new String[] { "*" + extension, "*.*", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ fg.setFileName(filename);
+ fg.setText(NLS.bind(Messages.CovManager_No_FilePath_Error, new Object[] { filePath, filename }));
+ String s = fg.open();
+ if (s == null) {
+ return null;
+ } else {
+ f = new File(s).getAbsoluteFile();
+ addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile());
+ if (f.isFile() && f.canRead()) {
+ FileInputStream fis = new FileInputStream(f);
+ InputStream inputStream = new BufferedInputStream(fis);
+ return new DataInputStream(inputStream);
+ }
+ }
+ }
+ return null;
}
public ArrayList<SourceFile> getAllSrcs() {
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java
index 107d13a67b..3e0121db9e 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcdaRecordsParser.java
@@ -272,21 +272,21 @@ public class GcdaRecordsParser {
* @return the objSmrySumMax
*/
public long getObjSmrySumMax() {
- return objSmrySumMax;
+ return objSmrySumMax;
}
/**
* @return the pgmSmryChksm
*/
public long getPgmSmryChksm() {
- return pgmSmryChksm;
+ return pgmSmryChksm;
}
/**
* @return the prgSmryNbrPgmRuns
*/
public long getPgmSmryNbrPgmRuns() {
- return pgmSmryNbrPgmRuns;
+ return pgmSmryNbrPgmRuns;
}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java
index 50f756711f..430fc36a03 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModel.java
@@ -132,20 +132,20 @@ public final class GcovAnnotationModel implements IAnnotationModel {
}
private void updateAnnotations(boolean force) {
- // We used to not annotate any editor displaying content of an element whose project was not tracked.
- // This logic fails when we have a linked-in file which won't point back to a project that has
- // been registered so it has been removed.
-
- SourceFile coverage = findSourceCoverageForEditor();
- if (coverage != null) {
- if (!annotated || force) {
- createAnnotations(coverage);
- }
- } else {
- if (annotated) {
- clear();
- }
- }
+ // We used to not annotate any editor displaying content of an element whose project was not tracked.
+ // This logic fails when we have a linked-in file which won't point back to a project that has
+ // been registered so it has been removed.
+
+ SourceFile coverage = findSourceCoverageForEditor();
+ if (coverage != null) {
+ if (!annotated || force) {
+ createAnnotations(coverage);
+ }
+ } else {
+ if (annotated) {
+ clear();
+ }
+ }
}
private SourceFile findSourceCoverageForEditor() {
@@ -170,87 +170,87 @@ public final class GcovAnnotationModel implements IAnnotationModel {
// is part of the fix for bug: 447554
private class FindLinkedResourceVisitor implements IResourceProxyVisitor {
- final private ICElement element;
- private boolean keepSearching = true;
- private boolean found;
+ final private ICElement element;
+ private boolean keepSearching = true;
+ private boolean found;
- public FindLinkedResourceVisitor(ICElement element) {
- this.element = element;
- }
+ public FindLinkedResourceVisitor(ICElement element) {
+ this.element = element;
+ }
- public boolean foundElement() {
- return found;
- }
+ public boolean foundElement() {
+ return found;
+ }
- @Override
- public boolean visit(IResourceProxy proxy) {
- if (proxy.isLinked() && proxy.requestResource().getLocationURI().equals(element.getLocationURI())) {
- found = true;
- keepSearching = false;
- }
- return keepSearching;
- }
+ @Override
+ public boolean visit(IResourceProxy proxy) {
+ if (proxy.isLinked() && proxy.requestResource().getLocationURI().equals(element.getLocationURI())) {
+ found = true;
+ keepSearching = false;
+ }
+ return keepSearching;
+ }
}
private SourceFile findSourceCoverageForElement(ICElement element) {
- List<SourceFile> sources = new ArrayList<> ();
- ICProject cProject = element.getCProject();
- IPath target = GcovAnnotationModelTracker.getInstance().getBinaryPath(cProject.getProject());
- if (target == null) {
- // We cannot find a target for this element, using it's project.
- // This can be caused by linking in a file to the project which may
- // not have a project or may point to another unseen project if the file originated
- // there.
- IProject[] trackedProjects = GcovAnnotationModelTracker.getInstance().getTrackedProjects();
- for (IProject proj : trackedProjects) {
- // Look at all projects that are registered for gcov viewing and see if the
- // element is linked in.
- try {
- FindLinkedResourceVisitor visitor = new FindLinkedResourceVisitor(element);
- proj.accept(visitor, IResource.DEPTH_INFINITE);
- // If we find a match, make note of the target and the real C project.
- if (visitor.foundElement()) {
- target = GcovAnnotationModelTracker.getInstance().getBinaryPath(proj);
- cProject = CoreModel.getDefault().getCModel().getCProject(proj.getName());
- break;
- }
- } catch (CoreException e) {
- }
- }
- if (target == null)
- return null;
- }
-
- try {
- IBinary[] binaries = cProject.getBinaryContainer().getBinaries();
- for (IBinary b : binaries) {
- if (b.getResource().getLocation().equals(target)) {
- CovManager covManager = new CovManager(b.getResource().getLocation().toOSString());
- covManager.processCovFiles(covManager.getGCDALocations(), null);
- sources.addAll(covManager.getAllSrcs());
- }
- }
- } catch (IOException|CoreException|InterruptedException e) {
- }
-
- for (SourceFile sf : sources) {
- IPath sfPath = new Path(sf.getName());
- IFile file = STLink2SourceSupport.getFileForPath(sfPath, cProject.getProject());
- if (file != null && element.getResource().getLocation().equals(file.getLocation())) {
- return sf;
- }
- }
-
- IPath binFolder = target.removeLastSegments(1);
- for (SourceFile sf : sources) {
- String sfPath = Paths.get(binFolder.toOSString()).resolve(sf.getName()).normalize().toString();
- if (sfPath.equals(element.getLocationURI().getPath())) {
- return sf;
- }
- }
-
- return null;
+ List<SourceFile> sources = new ArrayList<> ();
+ ICProject cProject = element.getCProject();
+ IPath target = GcovAnnotationModelTracker.getInstance().getBinaryPath(cProject.getProject());
+ if (target == null) {
+ // We cannot find a target for this element, using it's project.
+ // This can be caused by linking in a file to the project which may
+ // not have a project or may point to another unseen project if the file originated
+ // there.
+ IProject[] trackedProjects = GcovAnnotationModelTracker.getInstance().getTrackedProjects();
+ for (IProject proj : trackedProjects) {
+ // Look at all projects that are registered for gcov viewing and see if the
+ // element is linked in.
+ try {
+ FindLinkedResourceVisitor visitor = new FindLinkedResourceVisitor(element);
+ proj.accept(visitor, IResource.DEPTH_INFINITE);
+ // If we find a match, make note of the target and the real C project.
+ if (visitor.foundElement()) {
+ target = GcovAnnotationModelTracker.getInstance().getBinaryPath(proj);
+ cProject = CoreModel.getDefault().getCModel().getCProject(proj.getName());
+ break;
+ }
+ } catch (CoreException e) {
+ }
+ }
+ if (target == null)
+ return null;
+ }
+
+ try {
+ IBinary[] binaries = cProject.getBinaryContainer().getBinaries();
+ for (IBinary b : binaries) {
+ if (b.getResource().getLocation().equals(target)) {
+ CovManager covManager = new CovManager(b.getResource().getLocation().toOSString());
+ covManager.processCovFiles(covManager.getGCDALocations(), null);
+ sources.addAll(covManager.getAllSrcs());
+ }
+ }
+ } catch (IOException|CoreException|InterruptedException e) {
+ }
+
+ for (SourceFile sf : sources) {
+ IPath sfPath = new Path(sf.getName());
+ IFile file = STLink2SourceSupport.getFileForPath(sfPath, cProject.getProject());
+ if (file != null && element.getResource().getLocation().equals(file.getLocation())) {
+ return sf;
+ }
+ }
+
+ IPath binFolder = target.removeLastSegments(1);
+ for (SourceFile sf : sources) {
+ String sfPath = Paths.get(binFolder.toOSString()).resolve(sf.getName()).normalize().toString();
+ if (sfPath.equals(element.getLocationURI().getPath())) {
+ return sf;
+ }
+ }
+
+ return null;
}
private void createAnnotations(SourceFile sourceFile) {
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModelTracker.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModelTracker.java
index 4a82169ef9..b0dc4b1b72 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModelTracker.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/GcovAnnotationModelTracker.java
@@ -128,11 +128,11 @@ public final class GcovAnnotationModelTracker {
}
public void addProject (IProject project, IPath binary) {
- trackedProjects.put(project, binary);
+ trackedProjects.put(project, binary);
}
public IProject[] getTrackedProjects() {
- return trackedProjects.keySet().toArray(new IProject[0]);
+ return trackedProjects.keySet().toArray(new IProject[0]);
}
public void dispose() {
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java
index ca7656d397..5d8fa11ec2 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/annotatedsource/OpenSourceFileAction.java
@@ -47,24 +47,24 @@ public final class OpenSourceFileAction {
// FIXME: move this method in binutils plugin.
private static IFileStore getFileStore(IProject project, IPath path) {
- IEditorInput input = STLink2SourceSupport.getEditorInput(path, project);
- if (input instanceof IURIEditorInput) {
- IURIEditorInput editorInput = (IURIEditorInput) input;
- URI uri = editorInput.getURI();
- try {
- return EFS.getStore(uri);
- } catch (CoreException e) {
- return null;
- }
- } else if (input instanceof IFileEditorInput) {
- IFile f = ((IFileEditorInput) input).getFile();
- try {
- return EFS.getStore(f.getLocationURI());
- } catch (CoreException e) {
- return null;
- }
- }
- return null;
+ IEditorInput input = STLink2SourceSupport.getEditorInput(path, project);
+ if (input instanceof IURIEditorInput) {
+ IURIEditorInput editorInput = (IURIEditorInput) input;
+ URI uri = editorInput.getURI();
+ try {
+ return EFS.getStore(uri);
+ } catch (CoreException e) {
+ return null;
+ }
+ } else if (input instanceof IFileEditorInput) {
+ IFile f = ((IFileEditorInput) input).getFile();
+ try {
+ return EFS.getStore(f.getLocationURI());
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+ return null;
}
public static void openAnnotatedSourceFile(IProject project, IFile binary, SourceFile sourceFile, int lineNumber) {
diff --git a/gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/GprofLaunchTest.java b/gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/GprofLaunchTest.java
index d4e0107904..d0fd2a2bb0 100644
--- a/gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/GprofLaunchTest.java
+++ b/gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/GprofLaunchTest.java
@@ -74,15 +74,15 @@ public class GprofLaunchTest extends AbstractTest {
}
}
config = createConfiguration(proj.getProject());
-
+
enableGprofSupport(); //(otherwise test hangs on 'enable GGprof support' dialogue. )
-
- //---- Continue with launch.
+
+ //---- Continue with launch.
launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
wc = config.getWorkingCopy();
}
-
- private void enableGprofSupport() {
+
+ private void enableGprofSupport() {
String optionId = null;
if (CProjectBuildHelpers.isCppType(proj.getProject())) {
optionId = "gnu.cpp.compiler.option.debugging.gprof"; //$NON-NLS-1$
@@ -90,8 +90,8 @@ public class GprofLaunchTest extends AbstractTest {
optionId = "gnu.c.compiler.option.debugging.gprof"; //$NON-NLS-1$
}
CProjectBuildHelpers.setOptionInCDT(proj.getProject(), optionId, true);
- }
-
+ }
+
@After
public void tearDown() throws Exception {
deleteProject(proj);
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/DevHelpPlugin.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/DevHelpPlugin.java
index 36e5cf5bb2..f1206dd326 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/DevHelpPlugin.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/DevHelpPlugin.java
@@ -38,149 +38,149 @@ import org.osgi.framework.BundleContext;
*/
public class DevHelpPlugin extends AbstractUIPlugin implements IStartup {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.cdt.libhover.devhelp"; //$NON-NLS-1$
- private static final String REGENERATE_MSG = "Libhover.Devhelp.Regenerate.msg"; //$NON-NLS-1$
-
- // The shared instance
- private static DevHelpPlugin plugin;
-
- // Startup job
- private static Job k;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- k = new DevhelpStartupJob(LibHoverMessages.getString(REGENERATE_MSG)) ;
- k.schedule();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- k.cancel();
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static DevHelpPlugin getDefault() {
- return plugin;
- }
-
- @Override
- public void earlyStartup() {
- // do nothing...we just want start to get called and reparse the devhelp
- // directory
- }
-
- /**
- * Job used to load devhelp data on startup.
- *
- */
- private static class DevhelpStartupJob extends Job {
-
- private IProgressMonitor runMonitor;
-
- public DevhelpStartupJob(String name) {
- super(name);
- }
-
- @Override
- protected void canceling() {
- if (runMonitor != null)
- runMonitor.setCanceled(true);
- };
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- runMonitor = monitor;
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- IPreferenceStore ps = DevHelpPlugin.getDefault()
- .getPreferenceStore();
- String devhelpDir = ps.getString(PreferenceConstants.DEVHELP_DIRECTORY);
- IPath devhelpPath = new Path(devhelpDir);
- File devhelp = devhelpPath.toFile();
- if (!devhelp.exists()) {
- // No input data to process so quit now
- monitor.done();
- return Status.OK_STATUS;
- }
- long ltime = devhelp.lastModified();
- IPath libhoverPath = LibhoverPlugin.getDefault()
- .getStateLocation().append("C").append("devhelp.libhover"); //$NON-NLS-1$ //$NON-NLS-2$
- File libhoverDir = new File(libhoverPath.toOSString());
- if (libhoverDir.exists()) {
- long ltime2 = libhoverDir.lastModified();
- // Check the last modified time of the devhelp libhover file compared to the
- // devhelp directory we use to parse the data
- if (ltime < ltime2) {
- // Our devhelp info is up to date and is older than the last modification to
- // the devhelp input data so stop now
- monitor.done();
- return Status.OK_STATUS;
- }
- }
- ParseDevHelp.DevHelpParser p = new ParseDevHelp.DevHelpParser(
- ps.getString(PreferenceConstants.DEVHELP_DIRECTORY));
- LibHoverInfo hover = p.parse(monitor);
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- // Update the devhelp library info if it is on library list
- Collection<LibHoverLibrary> libs = LibHover.getLibraries();
- for (LibHoverLibrary l : libs) {
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- if (l.getName().equals("devhelp")) { //$NON-NLS-1$
- l.setHoverinfo(hover);
- break;
- }
- }
- try {
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- // Now, output the LibHoverInfo for caching later
- IPath location = LibhoverPlugin.getDefault()
- .getStateLocation().append("C"); //$NON-NLS-1$
- File ldir = new File(location.toOSString());
- ldir.mkdir();
- location = location.append("devhelp.libhover"); //$NON-NLS-1$
- try (FileOutputStream f = new FileOutputStream(
- location.toOSString());
- ObjectOutputStream out = new ObjectOutputStream(f)) {
- out.writeObject(hover);
- }
- monitor.done();
- } catch (NullPointerException e) {
- monitor.done();
- return Status.CANCEL_STATUS;
- } catch (IOException e) {
- monitor.done();
- return new Status(IStatus.ERROR, DevHelpPlugin.PLUGIN_ID,
- e.getLocalizedMessage(), e);
- }
-
- return Status.OK_STATUS;
- }
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.cdt.libhover.devhelp"; //$NON-NLS-1$
+ private static final String REGENERATE_MSG = "Libhover.Devhelp.Regenerate.msg"; //$NON-NLS-1$
+
+ // The shared instance
+ private static DevHelpPlugin plugin;
+
+ // Startup job
+ private static Job k;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ k = new DevhelpStartupJob(LibHoverMessages.getString(REGENERATE_MSG)) ;
+ k.schedule();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ k.cancel();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DevHelpPlugin getDefault() {
+ return plugin;
+ }
+
+ @Override
+ public void earlyStartup() {
+ // do nothing...we just want start to get called and reparse the devhelp
+ // directory
+ }
+
+ /**
+ * Job used to load devhelp data on startup.
+ *
+ */
+ private static class DevhelpStartupJob extends Job {
+
+ private IProgressMonitor runMonitor;
+
+ public DevhelpStartupJob(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void canceling() {
+ if (runMonitor != null)
+ runMonitor.setCanceled(true);
+ };
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ runMonitor = monitor;
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ IPreferenceStore ps = DevHelpPlugin.getDefault()
+ .getPreferenceStore();
+ String devhelpDir = ps.getString(PreferenceConstants.DEVHELP_DIRECTORY);
+ IPath devhelpPath = new Path(devhelpDir);
+ File devhelp = devhelpPath.toFile();
+ if (!devhelp.exists()) {
+ // No input data to process so quit now
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ long ltime = devhelp.lastModified();
+ IPath libhoverPath = LibhoverPlugin.getDefault()
+ .getStateLocation().append("C").append("devhelp.libhover"); //$NON-NLS-1$ //$NON-NLS-2$
+ File libhoverDir = new File(libhoverPath.toOSString());
+ if (libhoverDir.exists()) {
+ long ltime2 = libhoverDir.lastModified();
+ // Check the last modified time of the devhelp libhover file compared to the
+ // devhelp directory we use to parse the data
+ if (ltime < ltime2) {
+ // Our devhelp info is up to date and is older than the last modification to
+ // the devhelp input data so stop now
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ }
+ ParseDevHelp.DevHelpParser p = new ParseDevHelp.DevHelpParser(
+ ps.getString(PreferenceConstants.DEVHELP_DIRECTORY));
+ LibHoverInfo hover = p.parse(monitor);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ // Update the devhelp library info if it is on library list
+ Collection<LibHoverLibrary> libs = LibHover.getLibraries();
+ for (LibHoverLibrary l : libs) {
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ if (l.getName().equals("devhelp")) { //$NON-NLS-1$
+ l.setHoverinfo(hover);
+ break;
+ }
+ }
+ try {
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ // Now, output the LibHoverInfo for caching later
+ IPath location = LibhoverPlugin.getDefault()
+ .getStateLocation().append("C"); //$NON-NLS-1$
+ File ldir = new File(location.toOSString());
+ ldir.mkdir();
+ location = location.append("devhelp.libhover"); //$NON-NLS-1$
+ try (FileOutputStream f = new FileOutputStream(
+ location.toOSString());
+ ObjectOutputStream out = new ObjectOutputStream(f)) {
+ out.writeObject(hover);
+ }
+ monitor.done();
+ } catch (NullPointerException e) {
+ monitor.done();
+ return Status.CANCEL_STATUS;
+ } catch (IOException e) {
+ monitor.done();
+ return new Status(IStatus.ERROR, DevHelpPlugin.PLUGIN_ID,
+ e.getLocalizedMessage(), e);
+ }
+
+ return Status.OK_STATUS;
+ }
};
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
index 433c03582f..cb860a1984 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
@@ -56,471 +56,471 @@ import org.xml.sax.SAXException;
public class ParseDevHelp {
- private final static String PARSING_MSG = "Libhover.Devhelp.Parsing.msg"; //$NON-NLS-1$
- private final static String PARSING_FMT_MSG = "Libhover.Devhelp.Parsing.fmt.msg"; //$NON-NLS-1$
- private static class HTMLSaxParser extends AbstractSAXParser {
+ private final static String PARSING_MSG = "Libhover.Devhelp.Parsing.msg"; //$NON-NLS-1$
+ private final static String PARSING_FMT_MSG = "Libhover.Devhelp.Parsing.fmt.msg"; //$NON-NLS-1$
+ private static class HTMLSaxParser extends AbstractSAXParser {
- private boolean begin;
- private boolean refsect2;
- private boolean returnType;
- private boolean protoStart;
- private boolean parmStart;
- private boolean descStart;
- private boolean rowIgnore;
- private boolean valid = true;
- private HashMap<String, String> funcs;
- private String returnValue;
- private String funcName;
- private String rowTag;
- private StringBuilder prototype = new StringBuilder();
- private StringBuilder description = new StringBuilder();
- private int divCounter;
- private int rowItemCount;
- private TreeMap<String, FunctionInfo> infos = new TreeMap<>();
+ private boolean begin;
+ private boolean refsect2;
+ private boolean returnType;
+ private boolean protoStart;
+ private boolean parmStart;
+ private boolean descStart;
+ private boolean rowIgnore;
+ private boolean valid = true;
+ private HashMap<String, String> funcs;
+ private String returnValue;
+ private String funcName;
+ private String rowTag;
+ private StringBuilder prototype = new StringBuilder();
+ private StringBuilder description = new StringBuilder();
+ private int divCounter;
+ private int rowItemCount;
+ private TreeMap<String, FunctionInfo> infos = new TreeMap<>();
- public HTMLSaxParser(HashMap<String, String> funcs) {
- super(new HTMLConfiguration());
- this.funcs = funcs;
- }
+ public HTMLSaxParser(HashMap<String, String> funcs) {
+ super(new HTMLConfiguration());
+ this.funcs = funcs;
+ }
- @Override
- public void startElement(QName name, XMLAttributes a, Augmentations aug) {
- // look for a tag that matches one of the functions we are trying to find
- if ("A".equals(name.rawname)) { //$NON-NLS-1$
- String fname = a.getValue("name"); //$NON-NLS-1$
- String mapName = funcs.get(fname);
- if (mapName != null) {
- // We have found one of the functions we are looking for.
- // Register the name for later and allow function parsing to begin.
- funcName = mapName.trim();
- if (funcName.endsWith("()")) { //$NON-NLS-1$
- // Remove () at end of function name and remove all space chars which might be
- // non-breaking space chars which unfortunately do not get caught by the trim() method.
- funcName = this.funcName.replaceAll("\\(\\)", "").replaceAll("\\p{javaSpaceChar}",""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- begin = true;
- funcs.remove(fname); // take name off our list to do
- divCounter = refsect2 ? 1 : 0;
- refsect2 = false;
- }
- }
- if (begin) {
- if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
- ++divCounter;
- }
- if (!descStart) {
- if ("SPAN".equals(name.rawname)) { //$NON-NLS-1$
- String type = a.getValue("class"); //$NON-NLS-1$
- if (returnValue == null && type != null &&
- type.equals("returnvalue")) { //$NON-NLS-1$
- returnType = true;
- }
- } else if ("PRE".equals(name.rawname)) { //$NON-NLS-1$
- String type = a.getValue("class"); //$NON-NLS-1$
- if (type != null && type.equals("programlisting")) { //$NON-NLS-1$
- returnType = true;
- }
- }
- }
- if (protoStart) {
- if ("P".equals(name.rawname)) { //$NON-NLS-1$
- protoStart = false;
- descStart = true;
- description.append("<p>"); //$NON-NLS-1$
- }
- } else if (descStart) {
- if ("P".equals(name.rawname)) { //$NON-NLS-1$
- description.append("<p>"); //$NON-NLS-1$
- } else if ("TABLE".equals(name.rawname)) { //$NON-NLS-1$
- description.append("<dl>"); //$NON-NLS-1$
- } else if ("TR".equals(name.rawname)) { //$NON-NLS-1$
- rowItemCount = 0;
- } else if ("TD".equals(name.rawname)) { //$NON-NLS-1$
- String type = a.getValue("class"); //$NON-NLS-1$
- if (type != null && type.equals("listing_lines")) { //$NON-NLS-1$
- rowIgnore = true;
- } else {
- rowIgnore = false;
- if (rowItemCount++ == 0) {
- rowTag = "<dt>"; //$NON-NLS-1$
- } else {
- rowTag = "<dd>"; //$NON-NLS-1$
- }
- description.append(rowTag);
- }
- } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
- description.append("<br><br>"); //$NON-NLS-1$
- }
- }
- } else {
- if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
- String className = a.getValue("class"); //$NON-NLS-1$
- if ("refsect2".equals(className)) { //$NON-NLS-1$
- refsect2 = true;
- } else {
- refsect2 = false;
- }
- }
- }
- }
+ @Override
+ public void startElement(QName name, XMLAttributes a, Augmentations aug) {
+ // look for a tag that matches one of the functions we are trying to find
+ if ("A".equals(name.rawname)) { //$NON-NLS-1$
+ String fname = a.getValue("name"); //$NON-NLS-1$
+ String mapName = funcs.get(fname);
+ if (mapName != null) {
+ // We have found one of the functions we are looking for.
+ // Register the name for later and allow function parsing to begin.
+ funcName = mapName.trim();
+ if (funcName.endsWith("()")) { //$NON-NLS-1$
+ // Remove () at end of function name and remove all space chars which might be
+ // non-breaking space chars which unfortunately do not get caught by the trim() method.
+ funcName = this.funcName.replaceAll("\\(\\)", "").replaceAll("\\p{javaSpaceChar}",""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ begin = true;
+ funcs.remove(fname); // take name off our list to do
+ divCounter = refsect2 ? 1 : 0;
+ refsect2 = false;
+ }
+ }
+ if (begin) {
+ if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
+ ++divCounter;
+ }
+ if (!descStart) {
+ if ("SPAN".equals(name.rawname)) { //$NON-NLS-1$
+ String type = a.getValue("class"); //$NON-NLS-1$
+ if (returnValue == null && type != null &&
+ type.equals("returnvalue")) { //$NON-NLS-1$
+ returnType = true;
+ }
+ } else if ("PRE".equals(name.rawname)) { //$NON-NLS-1$
+ String type = a.getValue("class"); //$NON-NLS-1$
+ if (type != null && type.equals("programlisting")) { //$NON-NLS-1$
+ returnType = true;
+ }
+ }
+ }
+ if (protoStart) {
+ if ("P".equals(name.rawname)) { //$NON-NLS-1$
+ protoStart = false;
+ descStart = true;
+ description.append("<p>"); //$NON-NLS-1$
+ }
+ } else if (descStart) {
+ if ("P".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("<p>"); //$NON-NLS-1$
+ } else if ("TABLE".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("<dl>"); //$NON-NLS-1$
+ } else if ("TR".equals(name.rawname)) { //$NON-NLS-1$
+ rowItemCount = 0;
+ } else if ("TD".equals(name.rawname)) { //$NON-NLS-1$
+ String type = a.getValue("class"); //$NON-NLS-1$
+ if (type != null && type.equals("listing_lines")) { //$NON-NLS-1$
+ rowIgnore = true;
+ } else {
+ rowIgnore = false;
+ if (rowItemCount++ == 0) {
+ rowTag = "<dt>"; //$NON-NLS-1$
+ } else {
+ rowTag = "<dd>"; //$NON-NLS-1$
+ }
+ description.append(rowTag);
+ }
+ } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("<br><br>"); //$NON-NLS-1$
+ }
+ }
+ } else {
+ if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
+ String className = a.getValue("class"); //$NON-NLS-1$
+ if ("refsect2".equals(className)) { //$NON-NLS-1$
+ refsect2 = true;
+ } else {
+ refsect2 = false;
+ }
+ }
+ }
+ }
- @Override
- public void endElement(QName name, Augmentations aug) {
- if (begin) {
- if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
- --divCounter;
- if (divCounter <= 0) {
- // We have finished parsing the current function, reset all flags
- begin = false;
- descStart = false;
- parmStart = false;
- protoStart = false;
- // If valid, create and save the function info
- if (valid && returnValue != null &&
- !returnValue.startsWith("#") && //$NON-NLS-1$
- !returnValue.startsWith("typedef ")) { //$NON-NLS-1$
- FunctionInfo info = new FunctionInfo(funcName);
- info.setReturnType(returnValue);
- info.setPrototype(prototype.toString());
- info.setDescription(description.toString());
- infos.put(funcName, info);
- // Clear the description and prototype strings for next function
- description.setLength(0);
- prototype.setLength(0);
- if (funcs.isEmpty())
- throw new FuncFoundSaxException(); // indicate we are done and stop parser
- }
- }
- }
- if (descStart) {
- if ("P".equals(name.rawname)) {//$NON-NLS-1$
- description.append("</p>"); //$NON-NLS-1$
- } else if ("TABLE".equals(name.rawname)) { //$NON-NLS-1$
- description.append("</dl>"); //$NON-NLS-1$
- } else if ("TR".equals(name.rawname)) { //$NON-NLS-1$
- rowItemCount = 0;
- } else if ("TD".equals(name.rawname)) { //$NON-NLS-1$
- if (!rowIgnore) {
- if (rowTag != null && rowTag.equals("<dt>")) {//$NON-NLS-1$
- description.append("</dt>"); //$NON-NLS-1$
- } else {
- description.append("</dd>"); //$NON-NLS-1$
- }
- }
- rowIgnore = false;
- } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
- description.append("</br></br>"); //$NON-NLS-1$
- }
- }
- }
- }
+ @Override
+ public void endElement(QName name, Augmentations aug) {
+ if (begin) {
+ if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
+ --divCounter;
+ if (divCounter <= 0) {
+ // We have finished parsing the current function, reset all flags
+ begin = false;
+ descStart = false;
+ parmStart = false;
+ protoStart = false;
+ // If valid, create and save the function info
+ if (valid && returnValue != null &&
+ !returnValue.startsWith("#") && //$NON-NLS-1$
+ !returnValue.startsWith("typedef ")) { //$NON-NLS-1$
+ FunctionInfo info = new FunctionInfo(funcName);
+ info.setReturnType(returnValue);
+ info.setPrototype(prototype.toString());
+ info.setDescription(description.toString());
+ infos.put(funcName, info);
+ // Clear the description and prototype strings for next function
+ description.setLength(0);
+ prototype.setLength(0);
+ if (funcs.isEmpty())
+ throw new FuncFoundSaxException(); // indicate we are done and stop parser
+ }
+ }
+ }
+ if (descStart) {
+ if ("P".equals(name.rawname)) {//$NON-NLS-1$
+ description.append("</p>"); //$NON-NLS-1$
+ } else if ("TABLE".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("</dl>"); //$NON-NLS-1$
+ } else if ("TR".equals(name.rawname)) { //$NON-NLS-1$
+ rowItemCount = 0;
+ } else if ("TD".equals(name.rawname)) { //$NON-NLS-1$
+ if (!rowIgnore) {
+ if (rowTag != null && rowTag.equals("<dt>")) {//$NON-NLS-1$
+ description.append("</dt>"); //$NON-NLS-1$
+ } else {
+ description.append("</dd>"); //$NON-NLS-1$
+ }
+ }
+ rowIgnore = false;
+ } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("</br></br>"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
- @Override
- public void characters(XMLString data, Augmentations aug) {
- if (begin) {
- if (returnType) {
- returnValue = ""; //$NON-NLS-1$
- String tmp = data.toString().trim();
- boolean completed = false;
- if (tmp.endsWith(");")) { //$NON-NLS-1$
- completed = true;
- tmp = tmp.substring(0, tmp.length() - 2);
- }
- String tokens[] = tmp.split("\\s+"); //$NON-NLS-1$
- String separator = ""; //$NON-NLS-1$
- protoStart = true;
- for (int i = 0; i < tokens.length; ++i) {
- String token = tokens[i];
- if (!token.equals(funcName)) {
- returnValue += separator + token;
- separator = " "; //$NON-NLS-1$
- } else {
- separator = ""; //$NON-NLS-1$
- for (int j = i + 1; j < tokens.length; ++j) {
- String jtoken = tokens[j];
- if (j == i + 1 && jtoken.charAt(0) == '(') {
- jtoken = jtoken.substring(1);
- parmStart = true;
- protoStart = false;
- }
- prototype.append(separator).append(jtoken);
- separator = " "; //$NON-NLS-1$
- }
- if (parmStart && completed) {
- parmStart = false;
- descStart = true;
- }
- break;
- }
- }
- returnType = false;
- } else if (protoStart) {
- String temp = data.toString().trim();
- boolean completed = false;
- if (temp.endsWith(");")) { //$NON-NLS-1$
- completed = true;
- temp = temp.substring(0, temp.length() - 2);
- }
- String separator = " "; //$NON-NLS-1$
- while (temp.startsWith("*") || temp.startsWith("const")) { //$NON-NLS-1$ //$NON-NLS-2$
- if (temp.charAt(0) == '*') {
- returnValue += separator + "*"; //$NON-NLS-1$
- temp = temp.substring(1).trim();
- separator = ""; //$NON-NLS-1$
- } else {
- returnValue += "const"; //$NON-NLS-1$
- temp = temp.substring(5).trim();
- separator = " "; //$NON-NLS-1$
- }
- }
- int index = temp.lastIndexOf('(');
- int index2 = temp.lastIndexOf(')');
- if (index2 < index) {
- if (index + 1 < temp.length()) {
- temp = temp.substring(index + 1).trim();
- prototype.append(temp);
- }
- parmStart = true;
- protoStart = false;
- }
- if (parmStart && completed) {
- parmStart = false;
- descStart = true;
- }
- } else if (parmStart) {
- String parmData = data.toString().trim();
- int index = parmData.indexOf(')');
- if (index >= 0) {
- parmStart = false;
- descStart = true;
- parmData = parmData.substring(0, index);
- }
- if (prototype.length() == 0) {
- if (!parmData.equals(",") && !parmData.isEmpty()) { //$NON-NLS-1$
- parmData = " " + parmData; //$NON-NLS-1$
- }
- }
- prototype.append(parmData);
- } else if (descStart) {
- if (!rowIgnore) {
- description.append(String.valueOf(data));
- }
- }
- }
- }
+ @Override
+ public void characters(XMLString data, Augmentations aug) {
+ if (begin) {
+ if (returnType) {
+ returnValue = ""; //$NON-NLS-1$
+ String tmp = data.toString().trim();
+ boolean completed = false;
+ if (tmp.endsWith(");")) { //$NON-NLS-1$
+ completed = true;
+ tmp = tmp.substring(0, tmp.length() - 2);
+ }
+ String tokens[] = tmp.split("\\s+"); //$NON-NLS-1$
+ String separator = ""; //$NON-NLS-1$
+ protoStart = true;
+ for (int i = 0; i < tokens.length; ++i) {
+ String token = tokens[i];
+ if (!token.equals(funcName)) {
+ returnValue += separator + token;
+ separator = " "; //$NON-NLS-1$
+ } else {
+ separator = ""; //$NON-NLS-1$
+ for (int j = i + 1; j < tokens.length; ++j) {
+ String jtoken = tokens[j];
+ if (j == i + 1 && jtoken.charAt(0) == '(') {
+ jtoken = jtoken.substring(1);
+ parmStart = true;
+ protoStart = false;
+ }
+ prototype.append(separator).append(jtoken);
+ separator = " "; //$NON-NLS-1$
+ }
+ if (parmStart && completed) {
+ parmStart = false;
+ descStart = true;
+ }
+ break;
+ }
+ }
+ returnType = false;
+ } else if (protoStart) {
+ String temp = data.toString().trim();
+ boolean completed = false;
+ if (temp.endsWith(");")) { //$NON-NLS-1$
+ completed = true;
+ temp = temp.substring(0, temp.length() - 2);
+ }
+ String separator = " "; //$NON-NLS-1$
+ while (temp.startsWith("*") || temp.startsWith("const")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (temp.charAt(0) == '*') {
+ returnValue += separator + "*"; //$NON-NLS-1$
+ temp = temp.substring(1).trim();
+ separator = ""; //$NON-NLS-1$
+ } else {
+ returnValue += "const"; //$NON-NLS-1$
+ temp = temp.substring(5).trim();
+ separator = " "; //$NON-NLS-1$
+ }
+ }
+ int index = temp.lastIndexOf('(');
+ int index2 = temp.lastIndexOf(')');
+ if (index2 < index) {
+ if (index + 1 < temp.length()) {
+ temp = temp.substring(index + 1).trim();
+ prototype.append(temp);
+ }
+ parmStart = true;
+ protoStart = false;
+ }
+ if (parmStart && completed) {
+ parmStart = false;
+ descStart = true;
+ }
+ } else if (parmStart) {
+ String parmData = data.toString().trim();
+ int index = parmData.indexOf(')');
+ if (index >= 0) {
+ parmStart = false;
+ descStart = true;
+ parmData = parmData.substring(0, index);
+ }
+ if (prototype.length() == 0) {
+ if (!parmData.equals(",") && !parmData.isEmpty()) { //$NON-NLS-1$
+ parmData = " " + parmData; //$NON-NLS-1$
+ }
+ }
+ prototype.append(parmData);
+ } else if (descStart) {
+ if (!rowIgnore) {
+ description.append(String.valueOf(data));
+ }
+ }
+ }
+ }
- private TreeMap<String, FunctionInfo> getFunctionInfos() {
- return infos;
- }
+ private TreeMap<String, FunctionInfo> getFunctionInfos() {
+ return infos;
+ }
- @Override
- public String toString() {
- return "funcName: <" + funcName + "> returnType: <" + returnValue + //$NON-NLS-1$ //$NON-NLS-2$
- "> prototype: <" + prototype + "> description: " + description; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ @Override
+ public String toString() {
+ return "funcName: <" + funcName + "> returnType: <" + returnValue + //$NON-NLS-1$ //$NON-NLS-2$
+ "> prototype: <" + prototype + "> description: " + description; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
- public static class DevHelpParser {
+ public static class DevHelpParser {
- private static final class NullEntityResolver implements EntityResolver {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- return new InputSource(new StringReader("")); //$NON-NLS-1$
- }
- }
+ private static final class NullEntityResolver implements EntityResolver {
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) {
+ return new InputSource(new StringReader("")); //$NON-NLS-1$
+ }
+ }
- private static final class FilenameComparator implements
- Comparator<IFileStore> {
- @Override
- public int compare(IFileStore arg0, IFileStore arg1) {
- return (arg0.getName().compareToIgnoreCase(arg1.getName()));
- }
- }
+ private static final class FilenameComparator implements
+ Comparator<IFileStore> {
+ @Override
+ public int compare(IFileStore arg0, IFileStore arg1) {
+ return (arg0.getName().compareToIgnoreCase(arg1.getName()));
+ }
+ }
- private String dirName;
- private LibHoverInfo libhover;
- private boolean debug;
- private FilenameComparator filenameComparator = new FilenameComparator();
- private NullEntityResolver entityResolver = new NullEntityResolver();
- private DocumentBuilderFactory factory;
+ private String dirName;
+ private LibHoverInfo libhover;
+ private boolean debug;
+ private FilenameComparator filenameComparator = new FilenameComparator();
+ private NullEntityResolver entityResolver = new NullEntityResolver();
+ private DocumentBuilderFactory factory;
- public DevHelpParser(String dirName) {
- this(dirName, false);
- }
+ public DevHelpParser(String dirName) {
+ this(dirName, false);
+ }
- public DevHelpParser(String dirName, boolean debug) {
- this.dirName = dirName;
- this.libhover = new LibHoverInfo();
- this.debug = debug;
- factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- }
+ public DevHelpParser(String dirName, boolean debug) {
+ this.dirName = dirName;
+ this.libhover = new LibHoverInfo();
+ this.debug = debug;
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ }
- public LibHoverInfo getLibHoverInfo() {
- return libhover;
- }
+ public LibHoverInfo getLibHoverInfo() {
+ return libhover;
+ }
- public LibHoverInfo parse(IProgressMonitor monitor) {
- try {
- IFileSystem fs = EFS.getLocalFileSystem();
- IPath dirPath = new Path(dirName);
- IFileStore htmlDir = fs.getStore(dirPath);
- IFileStore[] files = htmlDir.childStores(EFS.NONE, null);
- monitor.beginTask(LibHoverMessages.getString(PARSING_MSG), files.length);
- Arrays.sort(files, filenameComparator);
- for (int i = 0; i < files.length; ++i) {
- IFileStore file = files[i];
- String name = file.fetchInfo().getName();
- if (monitor.isCanceled()) {
- return null;
- }
- monitor.setTaskName(LibHoverMessages.getFormattedString(PARSING_FMT_MSG,
- new String[]{name}));
- File f = new File(dirPath.append(name).append(name + ".devhelp2").toOSString()); //$NON-NLS-1$
- if (f.exists()) {
- parse(f.getAbsolutePath(),
- monitor);
- } else {
- parse(dirPath.append(name)
- .append(name + ".devhelp").toOSString(), //$NON-NLS-1$
- monitor);
- }
- monitor.worked(1);
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return libhover;
- }
+ public LibHoverInfo parse(IProgressMonitor monitor) {
+ try {
+ IFileSystem fs = EFS.getLocalFileSystem();
+ IPath dirPath = new Path(dirName);
+ IFileStore htmlDir = fs.getStore(dirPath);
+ IFileStore[] files = htmlDir.childStores(EFS.NONE, null);
+ monitor.beginTask(LibHoverMessages.getString(PARSING_MSG), files.length);
+ Arrays.sort(files, filenameComparator);
+ for (int i = 0; i < files.length; ++i) {
+ IFileStore file = files[i];
+ String name = file.fetchInfo().getName();
+ if (monitor.isCanceled()) {
+ return null;
+ }
+ monitor.setTaskName(LibHoverMessages.getFormattedString(PARSING_FMT_MSG,
+ new String[]{name}));
+ File f = new File(dirPath.append(name).append(name + ".devhelp2").toOSString()); //$NON-NLS-1$
+ if (f.exists()) {
+ parse(f.getAbsolutePath(),
+ monitor);
+ } else {
+ parse(dirPath.append(name)
+ .append(name + ".devhelp").toOSString(), //$NON-NLS-1$
+ monitor);
+ }
+ monitor.worked(1);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return libhover;
+ }
- private void parseLinks(HashMap<String, String> funcMap, String fileName, IPath path, LibHoverInfo libhover) {
- InputStream reader = null;
- HTMLSaxParser parser = null;
- try {
- reader = new FileInputStream(path.removeLastSegments(1).toOSString()
- + "/" + fileName); //$NON-NLS-1$
- parser = new HTMLSaxParser(funcMap);
- try {
- parser.parse(new InputSource(reader));
- } catch (FuncFoundSaxException e) {
- // ignore because this is just how we shorten parse time
- }
- reader.close();
- TreeMap<String, FunctionInfo> finfos = parser.getFunctionInfos();
- if (finfos != null) {
- if (debug) {
- System.out.println(parser.toString());
- }
- libhover.functions.putAll(finfos);
- }
- } catch (IOException e) {
- // ignore
- } catch (SAXException e) {
- e.printStackTrace();
- }
- }
+ private void parseLinks(HashMap<String, String> funcMap, String fileName, IPath path, LibHoverInfo libhover) {
+ InputStream reader = null;
+ HTMLSaxParser parser = null;
+ try {
+ reader = new FileInputStream(path.removeLastSegments(1).toOSString()
+ + "/" + fileName); //$NON-NLS-1$
+ parser = new HTMLSaxParser(funcMap);
+ try {
+ parser.parse(new InputSource(reader));
+ } catch (FuncFoundSaxException e) {
+ // ignore because this is just how we shorten parse time
+ }
+ reader.close();
+ TreeMap<String, FunctionInfo> finfos = parser.getFunctionInfos();
+ if (finfos != null) {
+ if (debug) {
+ System.out.println(parser.toString());
+ }
+ libhover.functions.putAll(finfos);
+ }
+ } catch (IOException e) {
+ // ignore
+ } catch (SAXException e) {
+ e.printStackTrace();
+ }
+ }
- private void parse(String fileName, IProgressMonitor monitor) {
- try {
- HashMap<String, HashMap<String,String>> files = new HashMap<>();
- Path path = new Path(fileName);
- File f = new File(fileName);
- FileInputStream stream = new FileInputStream(f);
- DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setEntityResolver(entityResolver);
- Document doc = builder.parse(stream);
- NodeList bookNodes = doc.getElementsByTagName("book"); //$NON-NLS-1$
- for (int x = 0; x < bookNodes.getLength(); ++x) {
- Node n = bookNodes.item(x);
- NamedNodeMap m = n.getAttributes();
- Node language = m.getNamedItem("language"); //$NON-NLS-1$
- if (language != null && !language.getNodeValue().equals("c")) { //$NON-NLS-1$
- return;
- }
- }
- if (path.getFileExtension().equals("devhelp")) { //$NON-NLS-1$
- // Get all function nodes
- NodeList nl = doc.getElementsByTagName("function"); // $NON-NLS-1$ //$NON-NLS-1$
- for (int i = 0; i < nl.getLength(); ++i) {
- if (monitor.isCanceled()) {
- return;
- }
- Node n = nl.item(i);
- NamedNodeMap m = n.getAttributes();
- // For each function node, get its associated link
- Node name = m.getNamedItem("name"); // $NON-NLS-1$ //$NON-NLS-1$
- Node link = m.getNamedItem("link"); // $NON-NLS-1$ //$NON-NLS-1$
- if (name != null && link != null) {
- String nameValue = name.getNodeValue();
- nameValue = nameValue.replaceAll("\\(.*\\);+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- if (!nameValue.contains("::") && !nameValue.startsWith("enum ") //$NON-NLS-1$ //$NON-NLS-2$
- && !nameValue.contains("\"")) { //$NON-NLS-1$
- String linkValue = link.getNodeValue();
- String[] linkParts = linkValue.split("#"); //$NON-NLS-1$
- // Check if the file referred to by the link has been seen before
- // If not, create a new function list for it
- HashMap<String, String> funcMap = files.get(linkParts[0]);
- if (funcMap == null) {
- funcMap = new HashMap<>();
- files.put(linkParts[0], funcMap);
- }
- // Add the function to the function list for the link file
- funcMap.put(linkParts[1], nameValue);
- }
- }
- }
- } else if (path.getFileExtension().equals("devhelp2")) { //$NON-NLS-1$
- NodeList nl = doc.getElementsByTagName("keyword"); // $NON-NLS-1$ //$NON-NLS-1$
- for (int i = 0; i < nl.getLength(); ++i) {
- if (monitor.isCanceled())
- return;
- Node n = nl.item(i);
- NamedNodeMap m = n.getAttributes();
- Node type = m.getNamedItem("type"); // $NON-NLS-1$ //$NON-NLS-1$
- if (type != null) {
- String typeName = type.getNodeValue();
- // Look for all function references in the devhelp file
- if (typeName.equals("function")) { //$NON-NLS-1$
- // Each function reference will have a link associated with it
- Node name = m.getNamedItem("name"); // $NON-NLS-1$ //$NON-NLS-1$
- Node link = m.getNamedItem("link"); // $NON-NLS-1$ //$NON-NLS-1$
- if (name != null && link != null) {
- // Clean up the name and make sure it isn't a non-C-function
- String nameValue = name.getNodeValue();
- nameValue = nameValue.replaceAll("\\(.*\\);+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- if (!nameValue.contains("::") && !nameValue.startsWith("enum ") //$NON-NLS-1$ //$NON-NLS-2$
- && !nameValue.contains("\"")) { //$NON-NLS-1$
- String linkValue = link.getNodeValue();
- String[] linkParts = linkValue.split("#"); //$NON-NLS-1$
- // Check to see if the file referred to by the link has been seen before
- // If not, create a new function list for it
- HashMap<String, String> funcMap = files.get(linkParts[0]);
- if (funcMap == null) {
- funcMap = new HashMap<>();
- files.put(linkParts[0], funcMap);
- }
- // Add the function to the function list for the link file
- funcMap.put(linkParts[1], nameValue);
- }
- }
- }
- }
- }
- }
- // For each different file found in function links in the devhelp file,
- // parse it and get all function info that is referred to
- for (Map.Entry<String, HashMap<String, String>> entry : files.entrySet()) {
- String fname = entry.getKey();
- HashMap<String, String> funcMap = entry.getValue();
- parseLinks(funcMap, fname, path, libhover);
- }
- } catch (FileNotFoundException e1) {
- // ignore
- } catch (ParserConfigurationException|SAXException|IOException e) {
- e.printStackTrace();
- }
- }
- }
+ private void parse(String fileName, IProgressMonitor monitor) {
+ try {
+ HashMap<String, HashMap<String,String>> files = new HashMap<>();
+ Path path = new Path(fileName);
+ File f = new File(fileName);
+ FileInputStream stream = new FileInputStream(f);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setEntityResolver(entityResolver);
+ Document doc = builder.parse(stream);
+ NodeList bookNodes = doc.getElementsByTagName("book"); //$NON-NLS-1$
+ for (int x = 0; x < bookNodes.getLength(); ++x) {
+ Node n = bookNodes.item(x);
+ NamedNodeMap m = n.getAttributes();
+ Node language = m.getNamedItem("language"); //$NON-NLS-1$
+ if (language != null && !language.getNodeValue().equals("c")) { //$NON-NLS-1$
+ return;
+ }
+ }
+ if (path.getFileExtension().equals("devhelp")) { //$NON-NLS-1$
+ // Get all function nodes
+ NodeList nl = doc.getElementsByTagName("function"); // $NON-NLS-1$ //$NON-NLS-1$
+ for (int i = 0; i < nl.getLength(); ++i) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ Node n = nl.item(i);
+ NamedNodeMap m = n.getAttributes();
+ // For each function node, get its associated link
+ Node name = m.getNamedItem("name"); // $NON-NLS-1$ //$NON-NLS-1$
+ Node link = m.getNamedItem("link"); // $NON-NLS-1$ //$NON-NLS-1$
+ if (name != null && link != null) {
+ String nameValue = name.getNodeValue();
+ nameValue = nameValue.replaceAll("\\(.*\\);+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!nameValue.contains("::") && !nameValue.startsWith("enum ") //$NON-NLS-1$ //$NON-NLS-2$
+ && !nameValue.contains("\"")) { //$NON-NLS-1$
+ String linkValue = link.getNodeValue();
+ String[] linkParts = linkValue.split("#"); //$NON-NLS-1$
+ // Check if the file referred to by the link has been seen before
+ // If not, create a new function list for it
+ HashMap<String, String> funcMap = files.get(linkParts[0]);
+ if (funcMap == null) {
+ funcMap = new HashMap<>();
+ files.put(linkParts[0], funcMap);
+ }
+ // Add the function to the function list for the link file
+ funcMap.put(linkParts[1], nameValue);
+ }
+ }
+ }
+ } else if (path.getFileExtension().equals("devhelp2")) { //$NON-NLS-1$
+ NodeList nl = doc.getElementsByTagName("keyword"); // $NON-NLS-1$ //$NON-NLS-1$
+ for (int i = 0; i < nl.getLength(); ++i) {
+ if (monitor.isCanceled())
+ return;
+ Node n = nl.item(i);
+ NamedNodeMap m = n.getAttributes();
+ Node type = m.getNamedItem("type"); // $NON-NLS-1$ //$NON-NLS-1$
+ if (type != null) {
+ String typeName = type.getNodeValue();
+ // Look for all function references in the devhelp file
+ if (typeName.equals("function")) { //$NON-NLS-1$
+ // Each function reference will have a link associated with it
+ Node name = m.getNamedItem("name"); // $NON-NLS-1$ //$NON-NLS-1$
+ Node link = m.getNamedItem("link"); // $NON-NLS-1$ //$NON-NLS-1$
+ if (name != null && link != null) {
+ // Clean up the name and make sure it isn't a non-C-function
+ String nameValue = name.getNodeValue();
+ nameValue = nameValue.replaceAll("\\(.*\\);+", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!nameValue.contains("::") && !nameValue.startsWith("enum ") //$NON-NLS-1$ //$NON-NLS-2$
+ && !nameValue.contains("\"")) { //$NON-NLS-1$
+ String linkValue = link.getNodeValue();
+ String[] linkParts = linkValue.split("#"); //$NON-NLS-1$
+ // Check to see if the file referred to by the link has been seen before
+ // If not, create a new function list for it
+ HashMap<String, String> funcMap = files.get(linkParts[0]);
+ if (funcMap == null) {
+ funcMap = new HashMap<>();
+ files.put(linkParts[0], funcMap);
+ }
+ // Add the function to the function list for the link file
+ funcMap.put(linkParts[1], nameValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ // For each different file found in function links in the devhelp file,
+ // parse it and get all function info that is referred to
+ for (Map.Entry<String, HashMap<String, String>> entry : files.entrySet()) {
+ String fname = entry.getKey();
+ HashMap<String, String> funcMap = entry.getValue();
+ parseLinks(funcMap, fname, path, libhover);
+ }
+ } catch (FileNotFoundException e1) {
+ // ignore
+ } catch (ParserConfigurationException|SAXException|IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
public static void main(String[] args) {
long startParse = System.currentTimeMillis();
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/FuncFoundSaxException.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/FuncFoundSaxException.java
index ed4d74658d..f68711ddce 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/FuncFoundSaxException.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/FuncFoundSaxException.java
@@ -14,9 +14,9 @@ package org.eclipse.linuxtools.internal.cdt.libhover.devhelp.preferences;
// This class is just to allow us to end parsing devhelp docs once
// we have found the function we are interested in
public class FuncFoundSaxException extends RuntimeException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
}
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/BaseUITestCase.java b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/BaseUITestCase.java
index 4a8cfa8da2..ff0a526cd4 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/BaseUITestCase.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/BaseUITestCase.java
@@ -30,75 +30,75 @@ import org.junit.Before;
@SuppressWarnings("restriction")
public class BaseUITestCase {
-
+
private static final String DEFAULT_INDEXER_TIMEOUT_SEC = "10";
private static final String INDEXER_TIMEOUT_PROPERTY = "indexer.timeout";
/**
* Indexer timeout used by tests. To avoid this timeout expiring during debugging add
- * -Dindexer.timeout=some_large_number to VM arguments of the test launch configuration.
+ * -Dindexer.timeout=some_large_number to VM arguments of the test launch configuration.
*/
protected static final int INDEXER_TIMEOUT_SEC =
Integer.parseInt(System.getProperty(INDEXER_TIMEOUT_PROPERTY, DEFAULT_INDEXER_TIMEOUT_SEC));
- @Before
- public void setUp() {
- CPPASTNameBase.sAllowRecursionBindings= false;
+ @Before
+ public void setUp() {
+ CPPASTNameBase.sAllowRecursionBindings= false;
CPPASTNameBase.sAllowNameComputation= false;
CModelListener.sSuppressUpdateOfLastRecentlyUsed= true;
- final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IViewPart view= activePage.findView("org.eclipse.cdt.ui.tests.DOMAST.DOMAST");
- if (view != null) {
- activePage.hideView(view);
- }
- }
+ final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IViewPart view= activePage.findView("org.eclipse.cdt.ui.tests.DOMAST.DOMAST");
+ if (view != null) {
+ activePage.hideView(view);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ runEventQueue(0);
+ ResourceHelper.cleanUp();
+ }
- @After
- public void tearDown() throws Exception {
- runEventQueue(0);
- ResourceHelper.cleanUp();
- }
+ protected void runEventQueue(int time) {
+ final long endTime= System.currentTimeMillis() + time;
+ while (true) {
+ while (Display.getCurrent().readAndDispatch()) {
+ //
+ }
+ long diff= endTime - System.currentTimeMillis();
+ if (diff <= 0) {
+ break;
+ }
+ try {
+ Thread.sleep(Math.min(20, diff));
+ } catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
- protected void runEventQueue(int time) {
- final long endTime= System.currentTimeMillis() + time;
- while (true) {
- while (Display.getCurrent().readAndDispatch()) {
- //
- }
- long diff= endTime - System.currentTimeMillis();
- if (diff <= 0) {
- break;
- }
- try {
- Thread.sleep(Math.min(20, diff));
- } catch (InterruptedException e) {
- return;
- }
- }
- }
+ protected void closeAllEditors() {
+ IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage[] pages= window.getPages();
+ for (IWorkbenchPage page : pages) {
+ page.closeAllEditors(false);
+ }
+ }
+ }
- protected void closeAllEditors() {
- IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
- for (IWorkbenchWindow window : windows) {
- IWorkbenchPage[] pages= window.getPages();
- for (IWorkbenchPage page : pages) {
- page.closeAllEditors(false);
- }
- }
- }
-
- public static void waitForIndexer(ICProject project) throws InterruptedException {
- Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
+ public static void waitForIndexer(ICProject project) throws InterruptedException {
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
- final PDOMManager indexManager = CCoreInternals.getPDOMManager();
- assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
- long waitms= 1;
- while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
- Thread.sleep(waitms);
- waitms *= 2;
- }
- assertTrue(indexManager.isProjectRegistered(project));
- assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
- }
+ final PDOMManager indexManager = CCoreInternals.getPDOMManager();
+ assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
+ long waitms= 1;
+ while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
+ Thread.sleep(waitms);
+ waitms *= 2;
+ }
+ assertTrue(indexManager.isProjectRegistered(project));
+ assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
+ }
}
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/CProjectHelper.java b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/CProjectHelper.java
index d59a2a7ef6..e1e5737210 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/CProjectHelper.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/CProjectHelper.java
@@ -34,92 +34,92 @@ import org.eclipse.core.runtime.IProgressMonitor;
*/
@SuppressWarnings("restriction")
public class CProjectHelper {
-
- public final static String PLUGIN_ID = "org.eclipse.linuxtools.cdt.libhover.tests"; //$NON-NLS-1$
- public static ICProject createCProject(final String projectName, String binFolderName) throws CoreException {
- return createCCProject(projectName, binFolderName, null);
- }
-
- /**
- * Creates a ICProject.
- */
- public static ICProject createCProject(final String projectName, String binFolderName, final String indexerID) throws CoreException {
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- final ICProject newProject[] = new ICProject[1];
- ws.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IWorkspaceRoot root = ws.getRoot();
- IProject project = root.getProject(projectName);
- if (indexerID != null) {
- IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
- IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
- }
- if (!project.exists()) {
- project.create(null);
- } else {
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- if (!project.isOpen()) {
- project.open(null);
- }
- if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
- String projectId = PLUGIN_ID + ".TestProject";
- addNatureToProject(project, CProjectNature.C_NATURE_ID, null);
- CCorePlugin.getDefault().mapCProjectOwner(project, projectId, false);
- }
- addDefaultBinaryParser(project);
- newProject[0] = CCorePlugin.getDefault().getCoreModel().create(project);
- }
- }, null);
+ public final static String PLUGIN_ID = "org.eclipse.linuxtools.cdt.libhover.tests"; //$NON-NLS-1$
- return newProject[0];
- }
+ public static ICProject createCProject(final String projectName, String binFolderName) throws CoreException {
+ return createCCProject(projectName, binFolderName, null);
+ }
- /**
- * Add the default binary parser if no binary parser configured.
- *
- * @param project
- * @throws CoreException
- */
- public static boolean addDefaultBinaryParser(IProject project) throws CoreException {
- ICConfigExtensionReference[] binaryParsers= CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
- if (binaryParsers == null || binaryParsers.length == 0) {
- ICProjectDescription desc= CCorePlugin.getDefault().getProjectDescription(project);
- if (desc == null) {
- return false;
- }
-
- desc.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID);
- CCorePlugin.getDefault().setProjectDescription(project, desc);
- }
- return true;
- }
+ /**
+ * Creates a ICProject.
+ */
+ public static ICProject createCProject(final String projectName, String binFolderName, final String indexerID) throws CoreException {
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final ICProject newProject[] = new ICProject[1];
+ ws.run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ IWorkspaceRoot root = ws.getRoot();
+ IProject project = root.getProject(projectName);
+ if (indexerID != null) {
+ IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
+ IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
+ }
+ if (!project.exists()) {
+ project.create(null);
+ } else {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+ if (!project.isOpen()) {
+ project.open(null);
+ }
+ if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
+ String projectId = PLUGIN_ID + ".TestProject";
+ addNatureToProject(project, CProjectNature.C_NATURE_ID, null);
+ CCorePlugin.getDefault().mapCProjectOwner(project, projectId, false);
+ }
+ addDefaultBinaryParser(project);
+ newProject[0] = CCorePlugin.getDefault().getCoreModel().create(project);
+ }
+ }, null);
- public static ICProject createCCProject(final String projectName, final String binFolderName, final String indexerID) throws CoreException {
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- final ICProject newProject[] = new ICProject[1];
- ws.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ICProject cproject = createCProject(projectName, binFolderName, indexerID);
- if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
- addNatureToProject(cproject.getProject(), CCProjectNature.CC_NATURE_ID, null);
- }
- newProject[0] = cproject;
- }
- }, null);
- return newProject[0];
- }
+ return newProject[0];
+ }
- public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures = description.getNatureIds();
- String[] newNatures = new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length] = natureId;
- description.setNatureIds(newNatures);
- proj.setDescription(description, monitor);
- }
+ /**
+ * Add the default binary parser if no binary parser configured.
+ *
+ * @param project
+ * @throws CoreException
+ */
+ public static boolean addDefaultBinaryParser(IProject project) throws CoreException {
+ ICConfigExtensionReference[] binaryParsers= CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
+ if (binaryParsers == null || binaryParsers.length == 0) {
+ ICProjectDescription desc= CCorePlugin.getDefault().getProjectDescription(project);
+ if (desc == null) {
+ return false;
+ }
+
+ desc.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID);
+ CCorePlugin.getDefault().setProjectDescription(project, desc);
+ }
+ return true;
+ }
+
+ public static ICProject createCCProject(final String projectName, final String binFolderName, final String indexerID) throws CoreException {
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final ICProject newProject[] = new ICProject[1];
+ ws.run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ICProject cproject = createCProject(projectName, binFolderName, indexerID);
+ if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
+ addNatureToProject(cproject.getProject(), CCProjectNature.CC_NATURE_ID, null);
+ }
+ newProject[0] = cproject;
+ }
+ }, null);
+ return newProject[0];
+ }
+
+ public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = proj.getDescription();
+ String[] prevNatures = description.getNatureIds();
+ String[] newNatures = new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length] = natureId;
+ description.setNatureIds(newNatures);
+ proj.setDescription(description, monitor);
+ }
} \ No newline at end of file
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ContentAssistTests.java b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ContentAssistTests.java
index 7a0237d610..0081f241d5 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ContentAssistTests.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ContentAssistTests.java
@@ -49,68 +49,69 @@ import org.junit.Test;
*/
@SuppressWarnings("restriction")
public class ContentAssistTests extends BaseUITestCase {
- private final NullProgressMonitor monitor= new NullProgressMonitor();
- static IProject project;
- static ICProject cproject;
-
+ private final NullProgressMonitor monitor= new NullProgressMonitor();
+ static IProject project;
+ static ICProject cproject;
+
@Before
- public void setUpD() throws InterruptedException {
-
- if (project == null) {
- try {
- cproject = CProjectHelper.createCCProject("ContentAssistTestProject", "bin", IPDOMManager.ID_FAST_INDEXER); //$NON-NLS-1$ //$NON-NLS-2$
- project = cproject.getProject();
- waitForIndexer(cproject);
- } catch ( CoreException e ) {
- /*boo*/
- }
- if (project == null)
- fail("Unable to create project"); //$NON-NLS-1$
- }
- }
-
+ public void setUpD() throws InterruptedException {
+
+ if (project == null) {
+ try {
+ cproject = CProjectHelper.createCCProject("ContentAssistTestProject", "bin", IPDOMManager.ID_FAST_INDEXER); //$NON-NLS-1$ //$NON-NLS-2$
+ project = cproject.getProject();
+ waitForIndexer(cproject);
+ } catch ( CoreException e ) {
+ /*boo*/
+ }
+ if (project == null)
+ fail("Unable to create project"); //$NON-NLS-1$
+ }
+ }
+
private static void disableContributions (){
//disable the help books so we don't get proposals we weren't expecting
CHelpBookDescriptor helpBooks[];
- helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
- @Override
- public IProject getProject(){return project;}
- @Override
- public ITranslationUnit getTranslationUnit(){return null;}
- }
- );
- for (CHelpBookDescriptor helpBook : helpBooks) {
- if( helpBook != null && !helpBook.getCHelpBook().getTitle().contains("glibc") ) //$NON-NLS-1$
- helpBook.enable( false );
- }
+ helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
+ @Override
+ public IProject getProject(){return project;}
+ @Override
+ public ITranslationUnit getTranslationUnit(){return null;}
+ }
+ );
+ for (CHelpBookDescriptor helpBook : helpBooks) {
+ if( helpBook != null && !helpBook.getCHelpBook().getTitle().contains("glibc") ) //$NON-NLS-1$
+ helpBook.enable( false );
+ }
}
-
+
public void cleanupProject() {
closeAllEditors();
try{
- project.delete( true, false, monitor );
- project = null;
- } catch( Throwable e ){
- /*boo*/
- }
+ project.delete( true, false, monitor );
+ project = null;
+ } catch( Throwable e ){
+ /*boo*/
+ }
}
-
+
@After
- public void tearDownD() throws Exception {
- if( project == null || !project.exists() )
+ public void tearDownD() throws Exception {
+ if (project == null || !project.exists()) {
return;
-
+ }
+
closeAllEditors();
// wait for indexer before deleting project to avoid errors in the log
waitForIndexer(cproject);
-
+
IResource [] members = project.members();
for (IResource member : members) {
if( member.getName().equals( ".project" ) || member.getName().equals( ".cproject" ) ) //$NON-NLS-1$ //$NON-NLS-2$
continue;
if (member.getName().equals(".settings"))
- continue;
+ continue;
try{
member.delete( false, monitor );
} catch( Throwable e ){
@@ -119,38 +120,38 @@ public class ContentAssistTests extends BaseUITestCase {
}
cleanupProject();
- }
-
+ }
+
protected IFile importFile(String fileName, String contents ) throws Exception{
- //Obtain file handle
- IFile file = project.getProject().getFile(fileName);
-
- InputStream stream = new ByteArrayInputStream( contents.getBytes() );
- //Create file input stream
- if( file.exists() )
- file.setContents( stream, false, false, monitor );
- else
- file.create( stream, false, monitor );
-
- return file;
- }
-
+ //Obtain file handle
+ IFile file = project.getProject().getFile(fileName);
+
+ InputStream stream = new ByteArrayInputStream( contents.getBytes() );
+ //Create file input stream
+ if( file.exists() )
+ file.setContents( stream, false, false, monitor );
+ else
+ file.create( stream, false, monitor );
+
+ return file;
+ }
+
protected ICompletionProposal[] getResults( IFile file, int offset ) throws Exception {
- disableContributions();
- // call the ContentAssistProcessor
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- FileEditorInput editorInput = new FileEditorInput(file);
- IEditorPart editorPart = page.openEditor(editorInput, "org.eclipse.cdt.ui.editor.CEditor");
- CEditor editor = (CEditor) editorPart ;
- @SuppressWarnings("unused")
- IAction completionAction = editor.getAction("ContentAssistProposal");
-
- String contentType = editor.getViewer().getDocument().getContentType(offset);
- ContentAssistant assistant = new ContentAssistant();
- CContentAssistProcessor processor = new CContentAssistProcessor(editor, assistant, contentType);
- return processor.computeCompletionProposals(editor.getViewer(), offset);
+ disableContributions();
+ // call the ContentAssistProcessor
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ FileEditorInput editorInput = new FileEditorInput(file);
+ IEditorPart editorPart = page.openEditor(editorInput, "org.eclipse.cdt.ui.editor.CEditor");
+ CEditor editor = (CEditor) editorPart ;
+ @SuppressWarnings("unused")
+ IAction completionAction = editor.getAction("ContentAssistProposal");
+
+ String contentType = editor.getViewer().getDocument().getContentType(offset);
+ ContentAssistant assistant = new ContentAssistant();
+ CContentAssistProcessor processor = new CContentAssistProcessor(editor, assistant, contentType);
+ return processor.computeCompletionProposals(editor.getViewer(), offset);
}
-
+
@Test
public void testBug69334a() throws Exception {
importFile( "test.h", "class Test{ public : Test( int ); }; \n" ); //$NON-NLS-1$//$NON-NLS-2$
@@ -160,12 +161,12 @@ public class ContentAssistTests extends BaseUITestCase {
writer.write( "int main() { \n"); //$NON-NLS-1$
writer.write( " int veryLongName = 1; \n"); //$NON-NLS-1$
writer.write( " Test * ptest = new Test( very \n"); //$NON-NLS-1$
-
+
String code = writer.toString();
IFile cu = importFile( "test.cpp", code ); //$NON-NLS-1$
-
+
ICompletionProposal [] results = getResults( cu, code.indexOf( "very " ) + 4 ); //$NON-NLS-1$
-
+
assertEquals( 1, results.length );
assertEquals( "veryLongName : int", results[0].getDisplayString() ); //$NON-NLS-1$
}
@@ -179,12 +180,12 @@ public class ContentAssistTests extends BaseUITestCase {
writer.write( "int main() { \n"); //$NON-NLS-1$
writer.write( " int veryLongName = 1; \n"); //$NON-NLS-1$
writer.write( " Test test( very \n"); //$NON-NLS-1$
-
+
String code = writer.toString();
IFile cu = importFile( "test.cpp", code ); //$NON-NLS-1$
-
+
ICompletionProposal [] results = getResults( cu, code.indexOf( "very " ) + 4 ); //$NON-NLS-1$
-
+
assertEquals( 1, results.length );
// We should not match anything in glibc and only see something from the source code
assertEquals( "veryLongName : int", results[0].getDisplayString() ); //$NON-NLS-1$
@@ -200,37 +201,37 @@ public class ContentAssistTests extends BaseUITestCase {
writer.write( " _Ability getAbility(); \n"); //$NON-NLS-1$
writer.write( "}; \n"); //$NON-NLS-1$
writer.write( "int main(){ \n"); //$NON-NLS-1$
-
+
String code = writer.toString();
String c2 = code + " Strategy *p[3] = { new Strategy( Str \n"; //$NON-NLS-1$
-
+
IFile cu = importFile( "strategy.cpp", c2 ); //$NON-NLS-1$
-
+
ICompletionProposal [] results = getResults( cu, c2.indexOf( "Str " ) + 3 ); //$NON-NLS-1$
assertEquals( 1, results.length );
assertEquals( "Strategy", results[0].getDisplayString() ); //$NON-NLS-1$
-
+
c2 = code + " Strategy *p[3] = { new Strategy( Strategy:: \n"; //$NON-NLS-1$
cu = importFile( "strategy.cpp", c2 ); //$NON-NLS-1$
-
+
results = getResults( cu, c2.indexOf( "::" ) + 2 ); //$NON-NLS-1$
-
+
// Verify we only get back completions from the source code and not glibc function completions
assertEquals( 4, results.length );
assertEquals( "CHEAT", results[0].getDisplayString() ); //$NON-NLS-1$
assertEquals( "IDIOT", results[1].getDisplayString() ); //$NON-NLS-1$
assertEquals( "NORMAL", results[2].getDisplayString() ); //$NON-NLS-1$
- // "_Ability" is here due to fix for bug 199598
+ // "_Ability" is here due to fix for bug 199598
// Difficult to differentiate between declaration and expression context
assertEquals( "_Ability", results[3].getDisplayString() ); //$NON-NLS-1$
// in a method definition context, constructors and methods should be proposed
-
+
c2 = code + "return 0;}\nStrategy::\n"; //$NON-NLS-1$
cu = importFile( "strategy.cpp", c2 ); //$NON-NLS-1$
-
+
results = getResults( cu, c2.indexOf( "::" ) + 2 ); //$NON-NLS-1$
assertEquals( 3, results.length );
assertEquals( "getAbility(void) : enum _Ability", results[1].getDisplayString() ); //$NON-NLS-1$
@@ -251,20 +252,19 @@ public class ContentAssistTests extends BaseUITestCase {
String code = writer.toString();
IFile cu = importFile( "t.cpp", code ); //$NON-NLS-1$
ICompletionProposal [] results = getResults( cu, code.indexOf( "v " ) + 1 ); //$NON-NLS-1$
-
+
assertTrue( results.length >= 5 );
-
+
// Verify first 2 suggestions come from glibc
assertEquals( results[0].getDisplayString(), "valloc (size_t size) void *" ); //$NON-NLS-1$
assertEquals( results[1].getDisplayString(), "vasprintf (char **ptr, const char *template, va_list ap) int" ); //$NON-NLS-1$
-
-
+
// Verify end of list contains completions from indexer
assertEquals( results[results.length - 3].getDisplayString(), "var : float" ); //$NON-NLS-1$
assertEquals( results[results.length - 2].getDisplayString(), "virtual" ); //$NON-NLS-1$
assertEquals( results[results.length - 1].getDisplayString(), "volatile" ); //$NON-NLS-1$
}
-
+
@Test
public void testCfunc() throws Exception {
StringWriter writer = new StringWriter();
@@ -276,13 +276,13 @@ public class ContentAssistTests extends BaseUITestCase {
String code = writer.toString();
IFile cu = importFile( "t.c", code ); //$NON-NLS-1$
ICompletionProposal [] results = getResults( cu, code.indexOf( "strle " ) + 5 ); //$NON-NLS-1$
-
+
assertTrue( results.length >= 1 );
-
+
// Verify we find the glibc strlen function
assertEquals( results[0].getDisplayString(), "strlen (const char *s) size_t" ); //$NON-NLS-1$
-
+
if (results.length > 1) // if newlib book also enabled, verify it is correct too
- assertEquals( results[1].getDisplayString(), "strlen (const char *str) size_t " ); //$NON-NLS-1$
+ assertEquals( results[1].getDisplayString(), "strlen (const char *str) size_t " ); //$NON-NLS-1$
}
}
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ResourceHelper.java b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ResourceHelper.java
index b6bca70189..e4d8b567b7 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ResourceHelper.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.tests/src/org/eclipse/linuxtools/cdt/libhover/tests/ResourceHelper.java
@@ -35,62 +35,62 @@ import org.eclipse.core.runtime.NullProgressMonitor;
* @since 6.0
*/
public class ResourceHelper {
- private final static IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
+ private final static IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
- private final static Set<String> externalFilesCreated = new HashSet<>();
- private final static Set<IResource> resourcesCreated = new HashSet<>();
+ private final static Set<String> externalFilesCreated = new HashSet<>();
+ private final static Set<IResource> resourcesCreated = new HashSet<>();
- /**
- * Clean-up any files created as part of a unit test.
- * This method removes *all* Workspace IResources and any external
- * files / folders created with the #createWorkspaceFile #createWorkspaceFolder
- * methods in this class
- */
- public static void cleanUp() throws CoreException {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- root.refreshLocal(IResource.DEPTH_INFINITE, NULL_MONITOR);
+ /**
+ * Clean-up any files created as part of a unit test.
+ * This method removes *all* Workspace IResources and any external
+ * files / folders created with the #createWorkspaceFile #createWorkspaceFolder
+ * methods in this class
+ */
+ public static void cleanUp() throws CoreException {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ root.refreshLocal(IResource.DEPTH_INFINITE, NULL_MONITOR);
- // Delete all external files & folders created using ResourceHelper
- for (String loc : externalFilesCreated) {
- File f = new File(loc);
- if (f.exists())
- deleteRecursive(f);
- }
- externalFilesCreated.clear();
+ // Delete all external files & folders created using ResourceHelper
+ for (String loc : externalFilesCreated) {
+ File f = new File(loc);
+ if (f.exists())
+ deleteRecursive(f);
+ }
+ externalFilesCreated.clear();
- // Remove IResources created by this helper
- for (IResource r : resourcesCreated) {
- if (r.exists()) {
- try {
- r.delete(true, NULL_MONITOR);
- } catch (CoreException e) {
- // Ignore
- }
- }
- }
- resourcesCreated.clear();
- }
+ // Remove IResources created by this helper
+ for (IResource r : resourcesCreated) {
+ if (r.exists()) {
+ try {
+ r.delete(true, NULL_MONITOR);
+ } catch (CoreException e) {
+ // Ignore
+ }
+ }
+ }
+ resourcesCreated.clear();
+ }
- /**
- * Recursively delete a directory / file
- *
- * For safety this method only deletes files created under the workspace
- *
- * @param file
- */
- private static final void deleteRecursive(File f) throws IllegalArgumentException {
- // Ensure that the file being deleted is a child of the workspace
- // root to prevent anything nasty happening
- if (!f.getAbsolutePath().startsWith(
- ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getAbsolutePath())) {
- throw new IllegalArgumentException("File must exist within the workspace!");
- }
+ /**
+ * Recursively delete a directory / file
+ *
+ * For safety this method only deletes files created under the workspace
+ *
+ * @param file
+ */
+ private static final void deleteRecursive(File f) throws IllegalArgumentException {
+ // Ensure that the file being deleted is a child of the workspace
+ // root to prevent anything nasty happening
+ if (!f.getAbsolutePath().startsWith(
+ ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getAbsolutePath())) {
+ throw new IllegalArgumentException("File must exist within the workspace!");
+ }
- if (f.isDirectory()) {
- for (File f1 : f.listFiles()) {
- deleteRecursive(f1);
- }
- }
- f.delete();
- }
+ if (f.isDirectory()) {
+ for (File f1 : f.listFiles()) {
+ deleteRecursive(f1);
+ }
+ }
+ f.delete();
+ }
}
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java b/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java
index 8590abd3dc..ed300a9f43 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java
@@ -43,7 +43,7 @@ public class LibhoverPlugin extends AbstractUIPlugin {
private static IPreferenceStore preferenceStore;
static {
- plugin = new LibhoverPlugin();
+ plugin = new LibhoverPlugin();
}
/**
@@ -81,11 +81,11 @@ public class LibhoverPlugin extends AbstractUIPlugin {
}
private void save() {
- if (stateLocation == null)
- stateLocation = this.getStateLocation();
- if (preferenceStore == null)
- preferenceStore = this.getPreferenceStore();
- LibHover.saveLibraries(stateLocation, preferenceStore);
+ if (stateLocation == null)
+ stateLocation = this.getStateLocation();
+ if (preferenceStore == null)
+ preferenceStore = this.getPreferenceStore();
+ LibHover.saveLibraries(stateLocation, preferenceStore);
}
/*
@@ -94,10 +94,10 @@ public class LibhoverPlugin extends AbstractUIPlugin {
*/
@Override
public void stop(BundleContext context) throws Exception {
- stateLocation = this.getStateLocation();
- preferenceStore = this.getPreferenceStore();
- plugin = null;
- super.stop(context);
+ stateLocation = this.getStateLocation();
+ preferenceStore = this.getPreferenceStore();
+ plugin = null;
+ super.stop(context);
}
/**
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java b/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java
index 998ca1cfb0..8ef7c2c385 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java
@@ -117,10 +117,10 @@ public class LibHover implements ICHelpProvider {
}
public static void saveLibraries(IPath locationBase, IPreferenceStore ps) {
- // If user preference is to cache libhover data, then save any un-saved
- // library hover data.
- if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER)) {
- for (Iterator<LibHoverLibrary> i = libraries.values().iterator(); i.hasNext();) {
+ // If user preference is to cache libhover data, then save any un-saved
+ // library hover data.
+ if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER)) {
+ for (Iterator<LibHoverLibrary> i = libraries.values().iterator(); i.hasNext();) {
LibHoverLibrary l = i.next();
try {
// Now, output the LibHoverInfo for caching later
@@ -744,15 +744,15 @@ public class LibHover implements ICHelpProvider {
@Override
public ICHelpResourceDescriptor[] getHelpResources(ICHelpInvocationContext context, ICHelpBook[] helpBooks, String name) {
- for (int i = 0; i < helpBooks.length; ++i) {
- IFunctionSummary fs = getFunctionInfo(context, new ICHelpBook[]{helpBooks[i]}, name);
- if (fs != null) {
- LibHoverLibrary l = libraries.get(helpBooks[i]);
- if (l != null && l.getDocs() != null) {
- return new HelpResourceDescriptor[]{new HelpResourceDescriptor(helpBooks[i])};
- }
- }
- }
+ for (int i = 0; i < helpBooks.length; ++i) {
+ IFunctionSummary fs = getFunctionInfo(context, new ICHelpBook[]{helpBooks[i]}, name);
+ if (fs != null) {
+ LibHoverLibrary l = libraries.get(helpBooks[i]);
+ if (l != null && l.getDocs() != null) {
+ return new HelpResourceDescriptor[]{new HelpResourceDescriptor(helpBooks[i])};
+ }
+ }
+ }
return null;
}
}
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
index 2921a5dc2b..ee486eb08e 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/Activator.java
@@ -48,7 +48,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the bundle symbolic name of the plug-in.
- *
+ *
* @return an ID unique to this plug-in
*/
public String getPluginId() {
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/Messages.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/Messages.java
index 6a9989c7e2..990dba5a29 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/Messages.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/Messages.java
@@ -15,13 +15,13 @@ import org.eclipse.osgi.util.NLS;
@SuppressWarnings("javadoc")
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.man.parser.messages"; //$NON-NLS-1$
- public static String ManParser_RemoteAccessError;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.man.parser.messages"; //$NON-NLS-1$
+ public static String ManParser_RemoteAccessError;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
- private Messages() {
- }
+ private Messages() {
+ }
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
index 3fdca2b2f4..53786ecfe8 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java
@@ -66,10 +66,10 @@ public class Oprofile {
initializeOprofile();
}
- if (OprofileProject.getProfilingBinary().equals(OprofileProject.OPERF_BINARY)
- || isKernelModuleLoaded()) {
- initializeOprofileCore();
- }
+ if (OprofileProject.getProfilingBinary().equals(OprofileProject.OPERF_BINARY)
+ || isKernelModuleLoaded()) {
+ initializeOprofileCore();
+ }
}
// This requires more inside knowledge about Oprofile than one would like,
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java
index 3b9af510ae..7800879b56 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java
@@ -37,16 +37,16 @@ import org.xml.sax.SAXException;
* This class manipulates the XML data output from the command 'opxml sessions'
*/
public class SessionManager {
- public final static String PLUGIN_LOC = OprofileCorePlugin.getDefault()
+ public final static String PLUGIN_LOC = OprofileCorePlugin.getDefault()
.getStateLocation().toOSString();
- public final static String SESSIONS = "sessions"; //$NON-NLS-1$
- public final static String EVENT = "event"; //$NON-NLS-1$
- public final static String SESSION = "session"; //$NON-NLS-1$
- public final static String NAME = "name"; //$NON-NLS-1$
- public final static String CURRENT = "current"; //$NON-NLS-1$
- public final static String OPXML_PREFIX = PLUGIN_LOC + "/opxml_"; //$NON-NLS-1$
- public final static String SESSION_LOCATION = OPXML_PREFIX + SESSIONS;
- public final static String MODEL_DATA = "model-data"; //$NON-NLS-1$
+ public final static String SESSIONS = "sessions"; //$NON-NLS-1$
+ public final static String EVENT = "event"; //$NON-NLS-1$
+ public final static String SESSION = "session"; //$NON-NLS-1$
+ public final static String NAME = "name"; //$NON-NLS-1$
+ public final static String CURRENT = "current"; //$NON-NLS-1$
+ public final static String OPXML_PREFIX = PLUGIN_LOC + "/opxml_"; //$NON-NLS-1$
+ public final static String SESSION_LOCATION = OPXML_PREFIX + SESSIONS;
+ public final static String MODEL_DATA = "model-data"; //$NON-NLS-1$
public Document doc;
public Element root;
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
index be11490b35..decf5a13eb 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
@@ -283,12 +283,12 @@ public class OprofileCounter {
// Returns the event with the same label as the parameter STR
private OpEvent eventFromString(String str) {
- if (eventList != null) {
- for (int i = 0; i < eventList.length; i++) {
- if (eventList[i].getText().equals(str))
- return eventList[i];
- }
- }
+ if (eventList != null) {
+ for (int i = 0; i < eventList.length; i++) {
+ if (eventList[i].getText().equals(str))
+ return eventList[i];
+ }
+ }
return null;
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
index 95343714fa..da537b3adf 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
@@ -163,16 +163,16 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
controlCombo = new CCombo(p, SWT.DROP_DOWN|SWT.READ_ONLY|SWT.BORDER);
List<String> tools = new ArrayList<>(Arrays.asList(OprofileProject.OPERF_BINARY));
- try {
- Process proc = RuntimeProcessFactory.getFactory().exec(
- new String [] {"which", OprofileProject.OPCONTROL_BINARY }, //$NON-NLS-1$
- null);
- if (proc.waitFor() == 0) {
- tools.add(OprofileProject.OPCONTROL_BINARY);
- }
- } catch (Exception e) {
- }
- controlCombo.setItems(tools.toArray(new String [0]));
+ try {
+ Process proc = RuntimeProcessFactory.getFactory().exec(
+ new String [] {"which", OprofileProject.OPCONTROL_BINARY }, //$NON-NLS-1$
+ null);
+ if (proc.waitFor() == 0) {
+ tools.add(OprofileProject.OPCONTROL_BINARY);
+ }
+ } catch (Exception e) {
+ }
+ controlCombo.setItems(tools.toArray(new String [0]));
controlCombo.select(0);
controlCombo.addModifyListener(new ModifyListener() {
@Override
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
index c3da8ea75c..d9c7660b99 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
@@ -169,7 +169,7 @@ public abstract class AbstractOprofileLaunchConfigurationDelegate extends Abstra
for(int i = 0; i < options.getExecutionsNumber(); i++){
/*
* If profiling multiple times,
- * append oprofile results from 2nd execution on.
+ * append oprofile results from 2nd execution on.
*/
if (!appended && i!=0) {
argArray.add(1, APPEND);
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
index 511d351768..9f1c58d886 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDoubleClickListener.java
@@ -75,8 +75,8 @@ public class OprofileViewDoubleClickListener implements IDoubleClickListener {
} catch (PartInitException e2) {
e2.printStackTrace();
} catch (CoreException e) {
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
}
/**
@@ -84,7 +84,7 @@ public class OprofileViewDoubleClickListener implements IDoubleClickListener {
* @since 2.1
*/
protected IProject getProject() {
- return Oprofile.OprofileProject.getProject();
- }
+ return Oprofile.OprofileProject.getProject();
+ }
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/AbstractSaveDataHandler.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/AbstractSaveDataHandler.java
index fa23888468..9ea39c6fb2 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/AbstractSaveDataHandler.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/AbstractSaveDataHandler.java
@@ -120,18 +120,18 @@ public abstract class AbstractSaveDataHandler extends BaseDataManipulator implem
* Open error dialog informing user of saving failure.
* @param filename
*/
- public void openErroDialog(final String title, String pattern, String arg) {
- final String errorMsg = MessageFormat.format(pattern, new Object[] { arg });
- if (Display.getCurrent() != null) {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), title, errorMsg);
- } else {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), title, errorMsg);
- }
- });
- }
+ public void openErroDialog(final String title, String pattern, String arg) {
+ final String errorMsg = MessageFormat.format(pattern, new Object[] { arg });
+ if (Display.getCurrent() != null) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), title, errorMsg);
+ } else {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), title, errorMsg);
+ }
+ });
+ }
}
/**
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/Messages.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/Messages.java
index b2abc1185a..b5f06a52b9 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/Messages.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/Messages.java
@@ -16,14 +16,14 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.perf.launch.messages"; //$NON-NLS-1$
public static String MsgProxyError;
public static String PerfEventsTab_Add;
- public static String PerfEventsTab_Events;
- public static String PerfEventsTab_ForExample;
- public static String PerfEventsTab_ForExampleR1A8;
- public static String PerfEventsTab_HardwareBreakpoint;
- public static String PerfEventsTab_Note;
- public static String PerfEventsTab_RawRegisterEncoding;
- public static String PerfEventsTab_RemoveSelectedEvents;
- public static String PerfLaunchConfigDelegate_perf_not_found;
+ public static String PerfEventsTab_Events;
+ public static String PerfEventsTab_ForExample;
+ public static String PerfEventsTab_ForExampleR1A8;
+ public static String PerfEventsTab_HardwareBreakpoint;
+ public static String PerfEventsTab_Note;
+ public static String PerfEventsTab_RawRegisterEncoding;
+ public static String PerfEventsTab_RemoveSelectedEvents;
+ public static String PerfLaunchConfigDelegate_perf_not_found;
public static String PerfLaunchConfigDelegate_analyzing;
public static String PerfLaunchConfigDelegate_stat_title;
public static String PerfOptionsTab_Browse;
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
index b0d10f7c85..d6ee43498b 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
@@ -71,7 +71,7 @@ import org.osgi.framework.Version;
public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate {
- private static final String OUTPUT_STR = "--output="; //$NON-NLS-1$
+ private static final String OUTPUT_STR = "--output="; //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private IPath binPath;
private IPath workingDirPath;
@@ -85,7 +85,7 @@ public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate {
@Override
public void launch(ILaunchConfiguration config, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
- try {
+ try {
ConfigUtils configUtils = new ConfigUtils(config);
project = configUtils.getProject();
// check if Perf exists in $PATH
@@ -97,12 +97,12 @@ public class PerfLaunchConfigDelegate extends AbstractCLaunchDelegate {
URI binURI = new URI(configUtils.getExecutablePath());
binPath=Path.fromPortableString(binURI.getPath().toString());
if(binPath==null) {
- CDebugUtils.verifyProgramPath( config );
+ CDebugUtils.verifyProgramPath( config );
}
if (binPath.removeLastSegments(2).toPortableString().equals(EMPTY_STRING)) {
- workingDirPath=Path.fromPortableString(getWorkingDirectory(config).toURI().getPath());
+ workingDirPath=Path.fromPortableString(getWorkingDirectory(config).toURI().getPath());
} else {
- workingDirPath=Path.fromPortableString((binPath.removeLastSegments(2).toPortableString()) + IPath.SEPARATOR);
+ workingDirPath=Path.fromPortableString((binPath.removeLastSegments(2).toPortableString()) + IPath.SEPARATOR);
}
PerfPlugin.getDefault().setWorkingDir(workingDirPath);
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfDoubleClickAction.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfDoubleClickAction.java
index 9399541533..afd77bea74 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfDoubleClickAction.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfDoubleClickAction.java
@@ -69,7 +69,7 @@ public class PerfDoubleClickAction extends Action {
bFound = true;
}
if (!bFound) {
- ProfileUIUtils.openEditorAndSelect(file.getPath(), 1, ResourcesPlugin.getWorkspace().getRoot().getProject(dso.getName()));
+ ProfileUIUtils.openEditorAndSelect(file.getPath(), 1, ResourcesPlugin.getWorkspace().getRoot().getProject(dso.getName()));
}
}
// if we encounter an exception, act as though no corresponding source exists
diff --git a/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java b/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java
index dcdf921f34..909e6b30e9 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChart.java
@@ -46,11 +46,11 @@ public class PieChart extends Chart {
// with blanks in the PieChartPaintListener and have the title paint after it
// once the title has been altered.
if (title instanceof Control) {
- addPaintListener(pieChartPaintListener = new PieChartPaintListener(this));
+ addPaintListener(pieChartPaintListener = new PieChartPaintListener(this));
} else {
- removePaintListener((PaintListener)title);
- addPaintListener(pieChartPaintListener = new PieChartPaintListener(this));
- addPaintListener((PaintListener)title);
+ removePaintListener((PaintListener)title);
+ addPaintListener(pieChartPaintListener = new PieChartPaintListener(this));
+ addPaintListener((PaintListener)title);
}
IAxis xAxis = getAxisSet().getXAxis(0);
xAxis.enableCategory(true);
diff --git a/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java b/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java
index fcaf7c661b..303e2091b9 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers.piechart/src/org/eclipse/linuxtools/dataviewers/piechart/PieChartPaintListener.java
@@ -27,238 +27,238 @@ import org.swtchart.Range;
public class PieChartPaintListener implements PaintListener {
- private PieChart chart;
- private Control plotArea;
- private double[][] seriesValues;
- private String[] seriesNames;
- private static final int X_GAP = 10;
+ private PieChart chart;
+ private Control plotArea;
+ private double[][] seriesValues;
+ private String[] seriesNames;
+ private static final int X_GAP = 10;
- private static final Color WHITE = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
- private static final Color BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
- private static final String FONT = "Arial"; //$NON-NLS-1$
+ private static final Color WHITE = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
+ private static final Color BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
+ private static final String FONT = "Arial"; //$NON-NLS-1$
- private Point[] pieCenters;
- private int[][] pieSliceAngles;
- private int pieWidth;
+ private Point[] pieCenters;
+ private int[][] pieSliceAngles;
+ private int pieWidth;
- private String origTitleText;
+ private String origTitleText;
- /**
- * Handles drawing and updating of a PieChart, with titles given to its legend and
- * to each of its pies. Pies will be drawn in the given chart's plot area.
- * @param chart The PieChart to draw and update.
- * @since 2.0
- */
- public PieChartPaintListener(PieChart chart) {
- this.chart = chart;
- this.plotArea = chart.getPlotArea();
- }
+ /**
+ * Handles drawing and updating of a PieChart, with titles given to its legend and
+ * to each of its pies. Pies will be drawn in the given chart's plot area.
+ * @param chart The PieChart to draw and update.
+ * @since 2.0
+ */
+ public PieChartPaintListener(PieChart chart) {
+ this.chart = chart;
+ this.plotArea = chart.getPlotArea();
+ }
- @Override
- public void paintControl(PaintEvent e) {
- GC gc = e.gc;
- Rectangle bounds;
- this.getPieSeriesArray();
- pieCenters = new Point[seriesValues.length];
- pieSliceAngles = new int[seriesValues.length][];
- if (seriesValues.length == 0) {
- bounds = gc.getClipping();
- Font oldFont = gc.getFont();
- Font font = new Font(Display.getDefault(), FONT, 15, SWT.BOLD);
- gc.setForeground(BLACK);
- gc.setFont(font);
- String text = "No data"; //$NON-NLS-1$
- Point textSize = e.gc.textExtent(text);
- gc.drawText(text, (bounds.width - textSize.x) / 2, (bounds.height - textSize.y) / 2);
- gc.setFont(oldFont);
- font.dispose();
- return;
- }
- bounds = plotArea.getBounds();
- // Adjust the title so it centers in the plot area
- if (origTitleText == null) {
- origTitleText = chart.getTitle().getText();
- }
+ @Override
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ Rectangle bounds;
+ this.getPieSeriesArray();
+ pieCenters = new Point[seriesValues.length];
+ pieSliceAngles = new int[seriesValues.length][];
+ if (seriesValues.length == 0) {
+ bounds = gc.getClipping();
+ Font oldFont = gc.getFont();
+ Font font = new Font(Display.getDefault(), FONT, 15, SWT.BOLD);
+ gc.setForeground(BLACK);
+ gc.setFont(font);
+ String text = "No data"; //$NON-NLS-1$
+ Point textSize = e.gc.textExtent(text);
+ gc.drawText(text, (bounds.width - textSize.x) / 2, (bounds.height - textSize.y) / 2);
+ gc.setFont(oldFont);
+ font.dispose();
+ return;
+ }
+ bounds = plotArea.getBounds();
+ // Adjust the title so it centers in the plot area
+ if (origTitleText == null) {
+ origTitleText = chart.getTitle().getText();
+ }
- // We want to center the title in the plot area rather than the entire view which includes
- // the legend. To force this, we have two algorithms depending on what level of the
- // underlying SWT Chart software we are using. If the title is an SWT Control, we simply
- // set the title's location manually. If the title is just a PaintListener, we center it
- // by adding a number of trailing spaces which we calculate.
- if (chart.getTitle() instanceof Control) {
- setTitleBounds(bounds);
- } else {
- adjustTitle(e);
- }
- int width = bounds.width / seriesValues.length;
- int x = bounds.x;
+ // We want to center the title in the plot area rather than the entire view which includes
+ // the legend. To force this, we have two algorithms depending on what level of the
+ // underlying SWT Chart software we are using. If the title is an SWT Control, we simply
+ // set the title's location manually. If the title is just a PaintListener, we center it
+ // by adding a number of trailing spaces which we calculate.
+ if (chart.getTitle() instanceof Control) {
+ setTitleBounds(bounds);
+ } else {
+ adjustTitle(e);
+ }
+ int width = bounds.width / seriesValues.length;
+ int x = bounds.x;
- if (chart.getLegend().isVisible()) {
- Rectangle legendBounds = ((Control) chart.getLegend()).getBounds();
- Font oldFont = gc.getFont();
- Font font = new Font(Display.getDefault(), FONT, 10, SWT.BOLD);
- gc.setForeground(BLACK);
- gc.setFont(font);
- String text = chart.getAxisSet().getXAxis(0).getTitle().getText();
- Point textSize = e.gc.textExtent(text);
- gc.drawText(text, legendBounds.x + (legendBounds.width - textSize.x) / 2, legendBounds.y - textSize.y);
- gc.setFont(oldFont);
- font.dispose();
- }
+ if (chart.getLegend().isVisible()) {
+ Rectangle legendBounds = ((Control) chart.getLegend()).getBounds();
+ Font oldFont = gc.getFont();
+ Font font = new Font(Display.getDefault(), FONT, 10, SWT.BOLD);
+ gc.setForeground(BLACK);
+ gc.setFont(font);
+ String text = chart.getAxisSet().getXAxis(0).getTitle().getText();
+ Point textSize = e.gc.textExtent(text);
+ gc.drawText(text, legendBounds.x + (legendBounds.width - textSize.x) / 2, legendBounds.y - textSize.y);
+ gc.setFont(oldFont);
+ font.dispose();
+ }
- pieWidth = Math.min(width - X_GAP, bounds.height);
- for (int i = 0; i < seriesValues.length; i++) {
- drawPieChart(e, i, new Rectangle(x, bounds.y, width, bounds.height));
- x += width;
- }
- }
+ pieWidth = Math.min(width - X_GAP, bounds.height);
+ for (int i = 0; i < seriesValues.length; i++) {
+ drawPieChart(e, i, new Rectangle(x, bounds.y, width, bounds.height));
+ x += width;
+ }
+ }
- // For a title which is a Control, position it appropriately to center in the plot area.
- private void setTitleBounds(Rectangle bounds) {
- Control title = (Control) chart.getTitle();
- Rectangle titleBounds = title.getBounds();
- title.setLocation(new Point(bounds.x + (bounds.width - titleBounds.width) / 2, title.getLocation().y));
- }
+ // For a title which is a Control, position it appropriately to center in the plot area.
+ private void setTitleBounds(Rectangle bounds) {
+ Control title = (Control) chart.getTitle();
+ Rectangle titleBounds = title.getBounds();
+ title.setLocation(new Point(bounds.x + (bounds.width - titleBounds.width) / 2, title.getLocation().y));
+ }
- // Adjust the title with trailing blanks so it centers in the plot area
- // rather than for the entire chart view which looks odd when not
- // centered above the pie-charts themselves.
- private void adjustTitle(PaintEvent pe) {
- ITitle title = chart.getTitle();
- Font font = title.getFont();
- Font oldFont = pe.gc.getFont();
- pe.gc.setFont(font);
- Control legend = (Control)chart.getLegend();
- Rectangle legendBounds = legend.getBounds();
- int adjustment = legendBounds.width - 15;
- Point blankSize = pe.gc.textExtent(" "); //$NON-NLS-1$
- int numBlanks = ((adjustment / blankSize.x) >> 1) << 1;
- String text = origTitleText;
- for (int i = 0; i < numBlanks; ++i)
- text += " "; //$NON-NLS-1$
- pe.gc.setFont(oldFont);
- title.setText(text);
- }
+ // Adjust the title with trailing blanks so it centers in the plot area
+ // rather than for the entire chart view which looks odd when not
+ // centered above the pie-charts themselves.
+ private void adjustTitle(PaintEvent pe) {
+ ITitle title = chart.getTitle();
+ Font font = title.getFont();
+ Font oldFont = pe.gc.getFont();
+ pe.gc.setFont(font);
+ Control legend = (Control)chart.getLegend();
+ Rectangle legendBounds = legend.getBounds();
+ int adjustment = legendBounds.width - 15;
+ Point blankSize = pe.gc.textExtent(" "); //$NON-NLS-1$
+ int numBlanks = ((adjustment / blankSize.x) >> 1) << 1;
+ String text = origTitleText;
+ for (int i = 0; i < numBlanks; ++i)
+ text += " "; //$NON-NLS-1$
+ pe.gc.setFont(oldFont);
+ title.setText(text);
+ }
- private void drawPieChart(PaintEvent e, int chartnum, Rectangle bounds) {
- double series[] = seriesValues[chartnum];
- int nelemSeries = series.length;
- double sumTotal = 0;
+ private void drawPieChart(PaintEvent e, int chartnum, Rectangle bounds) {
+ double series[] = seriesValues[chartnum];
+ int nelemSeries = series.length;
+ double sumTotal = 0;
- pieSliceAngles[chartnum] = new int[nelemSeries - 1]; // Don't need first angle; it's always 0
- for (int i = 0; i < nelemSeries; i++) {
- sumTotal += series[i];
- }
+ pieSliceAngles[chartnum] = new int[nelemSeries - 1]; // Don't need first angle; it's always 0
+ for (int i = 0; i < nelemSeries; i++) {
+ sumTotal += series[i];
+ }
- GC gc = e.gc;
- Font oldFont = gc.getFont();
- gc.setLineWidth(1);
+ GC gc = e.gc;
+ Font oldFont = gc.getFont();
+ gc.setLineWidth(1);
- int pieX = bounds.x + (bounds.width - pieWidth) / 2;
- int pieY = bounds.y + (bounds.height - pieWidth) / 2;
- pieCenters[chartnum] = new Point(pieX + pieWidth / 2, pieY + pieWidth / 2);
- if (sumTotal == 0) {
- gc.drawOval(pieX, pieY, pieWidth, pieWidth);
- } else {
- double factor = 100 / sumTotal;
- int sweepAngle = 0;
- int incrementAngle = 0;
- int initialAngle = 90;
- for (int i = 0; i < nelemSeries; i++) {
- // Stored angles increase in clockwise direction from 0 degrees at 12:00
- if (i > 0) {
- pieSliceAngles[chartnum][i - 1] = 90 - initialAngle;
- }
+ int pieX = bounds.x + (bounds.width - pieWidth) / 2;
+ int pieY = bounds.y + (bounds.height - pieWidth) / 2;
+ pieCenters[chartnum] = new Point(pieX + pieWidth / 2, pieY + pieWidth / 2);
+ if (sumTotal == 0) {
+ gc.drawOval(pieX, pieY, pieWidth, pieWidth);
+ } else {
+ double factor = 100 / sumTotal;
+ int sweepAngle = 0;
+ int incrementAngle = 0;
+ int initialAngle = 90;
+ for (int i = 0; i < nelemSeries; i++) {
+ // Stored angles increase in clockwise direction from 0 degrees at 12:00
+ if (i > 0) {
+ pieSliceAngles[chartnum][i - 1] = 90 - initialAngle;
+ }
- gc.setBackground(((IBarSeries) chart.getSeriesSet().getSeries()[i]).getBarColor());
+ gc.setBackground(((IBarSeries) chart.getSeriesSet().getSeries()[i]).getBarColor());
- if (i == (nelemSeries - 1)) {
- sweepAngle = 360 - incrementAngle;
- } else {
- double angle = series[i] * factor * 3.6;
- sweepAngle = (int) Math.round(angle);
- }
- gc.fillArc(pieX, pieY, pieWidth, pieWidth, initialAngle, (-sweepAngle));
- gc.drawArc(pieX, pieY, pieWidth, pieWidth, initialAngle, (-sweepAngle));
- incrementAngle += sweepAngle;
- initialAngle += (-sweepAngle);
- }
- gc.drawLine(pieCenters[chartnum].x, pieCenters[chartnum].y, pieCenters[chartnum].x, pieCenters[chartnum].y - pieWidth / 2);
- }
+ if (i == (nelemSeries - 1)) {
+ sweepAngle = 360 - incrementAngle;
+ } else {
+ double angle = series[i] * factor * 3.6;
+ sweepAngle = (int) Math.round(angle);
+ }
+ gc.fillArc(pieX, pieY, pieWidth, pieWidth, initialAngle, (-sweepAngle));
+ gc.drawArc(pieX, pieY, pieWidth, pieWidth, initialAngle, (-sweepAngle));
+ incrementAngle += sweepAngle;
+ initialAngle += (-sweepAngle);
+ }
+ gc.drawLine(pieCenters[chartnum].x, pieCenters[chartnum].y, pieCenters[chartnum].x, pieCenters[chartnum].y - pieWidth / 2);
+ }
- Font font = new Font(Display.getDefault(), FONT, 12, SWT.BOLD);
- gc.setForeground(BLACK);
- gc.setBackground(WHITE);
- gc.setFont(font);
- String text = seriesNames[chartnum];
- Point textSize = e.gc.textExtent(text);
- gc.drawText(text, pieX + (pieWidth - textSize.x) / 2, pieY + pieWidth + textSize.y);
- gc.setFont(oldFont);
- font.dispose();
- }
+ Font font = new Font(Display.getDefault(), FONT, 12, SWT.BOLD);
+ gc.setForeground(BLACK);
+ gc.setBackground(WHITE);
+ gc.setFont(font);
+ String text = seriesNames[chartnum];
+ Point textSize = e.gc.textExtent(text);
+ gc.drawText(text, pieX + (pieWidth - textSize.x) / 2, pieY + pieWidth + textSize.y);
+ gc.setFont(oldFont);
+ font.dispose();
+ }
- private void getPieSeriesArray() {
- ISeries series[] = this.chart.getSeriesSet().getSeries();
- if (series == null || series.length == 0) {
- seriesValues = new double[0][0];
- seriesNames = new String[0];
- return;
- }
- String names[] = this.chart.getAxisSet().getXAxis(0).getCategorySeries();
- Range range = chart.getAxisSet().getXAxis(0).getRange();
- int itemRange = (int) range.upper - (int) range.lower + 1;
- int itemOffset = (int) range.lower;
- seriesValues = new double[itemRange][series.length];
- seriesNames = new String[itemRange];
+ private void getPieSeriesArray() {
+ ISeries series[] = this.chart.getSeriesSet().getSeries();
+ if (series == null || series.length == 0) {
+ seriesValues = new double[0][0];
+ seriesNames = new String[0];
+ return;
+ }
+ String names[] = this.chart.getAxisSet().getXAxis(0).getCategorySeries();
+ Range range = chart.getAxisSet().getXAxis(0).getRange();
+ int itemRange = (int) range.upper - (int) range.lower + 1;
+ int itemOffset = (int) range.lower;
+ seriesValues = new double[itemRange][series.length];
+ seriesNames = new String[itemRange];
- for (int i = 0; i < seriesValues.length; i++) {
- seriesNames[i] = names[i + itemOffset];
- for (int j = 0; j < seriesValues[i].length; j++) {
- double d[] = series[j].getXSeries();
- if (d != null && d.length > 0) {
- seriesValues[i][j] = d[i + itemOffset];
- } else {
- seriesValues[i][j] = 0;
- }
- }
- }
+ for (int i = 0; i < seriesValues.length; i++) {
+ seriesNames[i] = names[i + itemOffset];
+ for (int j = 0; j < seriesValues[i].length; j++) {
+ double d[] = series[j].getXSeries();
+ if (d != null && d.length > 0) {
+ seriesValues[i][j] = d[i + itemOffset];
+ } else {
+ seriesValues[i][j] = 0;
+ }
+ }
+ }
- return;
- }
+ return;
+ }
- /**
- * Given a set of 2D pixel coordinates (typically those of a mouse cursor), return the
- * index of the given pie's slice that those coordinates reside in.
- * @param chartnum The id of the chart.
- * @param x The x-coordinate to test.
- * @param y The y-coordinate to test.
- * @return The slice that contains the point with coordinates (x,y).
- * @since 2.0
- */
- public int getSliceIndexFromPosition(int chartnum, int x, int y) {
- Range range = chart.getAxisSet().getXAxis(0).getRange();
- chartnum -= (int) range.lower;
- if (chartnum >= pieCenters.length || chartnum < 0) {
- return -1;
- }
- // Only continue if the point is inside the pie circle
- double rad = Math.sqrt(Math.pow(pieCenters[chartnum].x - x, 2) + Math.pow(pieCenters[chartnum].y - y, 2));
- if (2 * rad > pieWidth) {
- return -1;
- }
- // Angle is relative to 12:00 position, increases clockwise
- double angle = Math.acos((pieCenters[chartnum].y - y) / rad) / Math.PI * 180.0;
- if (x - pieCenters[chartnum].x < 0) {
- angle = 360 - angle;
- }
- if (pieSliceAngles[chartnum].length == 0 || angle < pieSliceAngles[chartnum][0]) {
- return 0;
- }
- for (int s = 0; s < pieSliceAngles[chartnum].length - 1; s++) {
- if (pieSliceAngles[chartnum][s] <= angle && angle < pieSliceAngles[chartnum][s+1]) {
- return s + 1;
- }
- }
- return pieSliceAngles[chartnum].length;
- }
+ /**
+ * Given a set of 2D pixel coordinates (typically those of a mouse cursor), return the
+ * index of the given pie's slice that those coordinates reside in.
+ * @param chartnum The id of the chart.
+ * @param x The x-coordinate to test.
+ * @param y The y-coordinate to test.
+ * @return The slice that contains the point with coordinates (x,y).
+ * @since 2.0
+ */
+ public int getSliceIndexFromPosition(int chartnum, int x, int y) {
+ Range range = chart.getAxisSet().getXAxis(0).getRange();
+ chartnum -= (int) range.lower;
+ if (chartnum >= pieCenters.length || chartnum < 0) {
+ return -1;
+ }
+ // Only continue if the point is inside the pie circle
+ double rad = Math.sqrt(Math.pow(pieCenters[chartnum].x - x, 2) + Math.pow(pieCenters[chartnum].y - y, 2));
+ if (2 * rad > pieWidth) {
+ return -1;
+ }
+ // Angle is relative to 12:00 position, increases clockwise
+ double angle = Math.acos((pieCenters[chartnum].y - y) / rad) / Math.PI * 180.0;
+ if (x - pieCenters[chartnum].x < 0) {
+ angle = 360 - angle;
+ }
+ if (pieSliceAngles[chartnum].length == 0 || angle < pieSliceAngles[chartnum][0]) {
+ return 0;
+ }
+ for (int s = 0; s < pieSliceAngles[chartnum].length - 1; s++) {
+ if (pieSliceAngles[chartnum][s] <= angle && angle < pieSliceAngles[chartnum][s+1]) {
+ return s + 1;
+ }
+ }
+ return pieSliceAngles[chartnum].length;
+ }
}
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseAllTreeAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseAllTreeAction.java
index 76f12647b7..70dba2423b 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseAllTreeAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseAllTreeAction.java
@@ -32,8 +32,8 @@ public class STCollapseAllTreeAction extends Action {
*/
public STCollapseAllTreeAction(AbstractSTTreeViewer stViewer) {
super(STDataViewersMessages.collapseAllAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/collapse_all.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/collapse_all.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
}
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
index ce4ce700a1..e5f76e735c 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STCollapseSelectionAction.java
@@ -36,8 +36,8 @@ public class STCollapseSelectionAction extends Action {
*/
public STCollapseSelectionAction(AbstractSTTreeViewer stViewer) {
super(STDataViewersMessages.collapseSelectionAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/collapse_all.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/collapse_all.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
}
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STDataViewersSortAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STDataViewersSortAction.java
index 6cbd279de4..959f6eaa71 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STDataViewersSortAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STDataViewersSortAction.java
@@ -35,8 +35,8 @@ public class STDataViewersSortAction extends Action {
*/
public STDataViewersSortAction(AbstractSTViewer stViewer) {
super(STDataViewersMessages.sortAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/sort.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/sort.gif")); //$NON-NLS-1$
super.setToolTipText(STDataViewersMessages.sortAction_tooltip);
this.stViewer = stViewer;
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandAllTreeAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandAllTreeAction.java
index e1bad8dca9..d3b2bb3dc9 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandAllTreeAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandAllTreeAction.java
@@ -32,8 +32,8 @@ public class STExpandAllTreeAction extends Action {
*/
public STExpandAllTreeAction(AbstractSTTreeViewer stViewer) {
super(STDataViewersMessages.expandAllAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/expand_all.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/expand_all.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
}
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
index 3499237d19..0e55051906 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExpandSelectionAction.java
@@ -36,8 +36,8 @@ public class STExpandSelectionAction extends Action {
*/
public STExpandSelectionAction(AbstractSTTreeViewer stViewer) {
super(STDataViewersMessages.expandSelectionAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/expand_all.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/expand_all.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
}
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExportToCSVAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExportToCSVAction.java
index 5768aad18d..25e1697237 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExportToCSVAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STExportToCSVAction.java
@@ -46,8 +46,8 @@ public class STExportToCSVAction extends Action {
*/
public STExportToCSVAction(AbstractSTViewer stViewer) {
super(STDataViewersMessages.exportToCSVAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/export.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/export.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
this.exporter = new STDataViewersCSVExporter(stViewer);
diff --git a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STHideShowColAction.java b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STHideShowColAction.java
index 85b7f2101d..1f50f49714 100644
--- a/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STHideShowColAction.java
+++ b/profiling/org.eclipse.linuxtools.dataviewers/src/org/eclipse/linuxtools/dataviewers/actions/STHideShowColAction.java
@@ -32,8 +32,8 @@ public class STHideShowColAction extends Action {
*/
public STHideShowColAction(AbstractSTViewer stViewer) {
super(STDataViewersMessages.hideshowAction_title,
- AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
- "icons/prop_edt.gif")); //$NON-NLS-1$
+ AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
+ "icons/prop_edt.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
setEnabled(true);
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
index a8c393b479..83a8e21c00 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
@@ -68,25 +68,25 @@ public abstract class AbstractProfilingOptionsTab extends AbstractLaunchConfigur
@Override
public void createControl(Composite parent) {
- top = new Composite(parent, SWT.NONE);
- setControl(top);
- top.setLayout(new GridLayout(1, true));
-
- comboItems = getProviders();
- Set<String> providerNames = comboItems.keySet();
-
- providerCombo = new Combo(top, SWT.READ_ONLY);
- providerCombo.setItems(providerNames.toArray(new String[0]));
- if (providerNames.size() == 0) {
- providerCombo.setVisible(false);
- providerCombo.setEnabled(false);
- Label label = new Label(top, SWT.NULL);
- label.setText(Messages.ProfilingTab_no_category_profilers_installed);
- }
-
- tabgroup = new CTabFolder(top, SWT.NONE);
+ top = new Composite(parent, SWT.NONE);
+ setControl(top);
+ top.setLayout(new GridLayout(1, true));
+
+ comboItems = getProviders();
+ Set<String> providerNames = comboItems.keySet();
+
+ providerCombo = new Combo(top, SWT.READ_ONLY);
+ providerCombo.setItems(providerNames.toArray(new String[0]));
+ if (providerNames.size() == 0) {
+ providerCombo.setVisible(false);
+ providerCombo.setEnabled(false);
+ Label label = new Label(top, SWT.NULL);
+ label.setText(Messages.ProfilingTab_no_category_profilers_installed);
+ }
+
+ tabgroup = new CTabFolder(top, SWT.NONE);
tabgroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- true));
+ true));
providerCombo.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java
index a1c3010c75..009029b61d 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java
@@ -19,23 +19,23 @@ import org.eclipse.linuxtools.internal.profiling.launch.provider.launch.Provider
*/
public class ProfileCategoryEnablementTester extends PropertyTester {
- public ProfileCategoryEnablementTester() {
- }
+ public ProfileCategoryEnablementTester() {
+ }
- @Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
- ProfileLaunchShortcut x = null;
+ @Override
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+ ProfileLaunchShortcut x = null;
- if (args.length == 0)
- return true;
+ if (args.length == 0)
+ return true;
- // See if there is a profile provider for the given category
- x = ProviderFramework.getProfilingProvider((String)args[0]);
+ // See if there is a profile provider for the given category
+ x = ProviderFramework.getProfilingProvider((String)args[0]);
- if (x == null)
- return false;
- return true;
- }
+ if (x == null)
+ return false;
+ return true;
+ }
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java
index b1b6a6d9fb..2654e46c02 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java
@@ -189,7 +189,7 @@ public abstract class ProfileLaunchShortcut implements ILaunchShortcut {
/**
* Search and launch binary.
- *
+ *
* @param elements Binaries to search.
* @param mode Launch mode.
*/
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProxyLaunchMessages.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProxyLaunchMessages.java
index 1c9a48e19c..fc7cb7d305 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProxyLaunchMessages.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProxyLaunchMessages.java
@@ -47,20 +47,20 @@ public class ProxyLaunchMessages extends NLS {
public static String connection_of_working_directory_and_program_do_not_match;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String copy_cpp_executable;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String executable_origin;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String to;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String uri_syntax_error;
static {
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ui/FileSystemSelectionArea.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ui/FileSystemSelectionArea.java
index 963f474ec4..22be3bca9a 100755
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ui/FileSystemSelectionArea.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ui/FileSystemSelectionArea.java
@@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Label;
/**
* FileSystemSelectionArea is the area used to select the file system.
- *
+ *
* @since 2.0
*
*/
diff --git a/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/CProjectBuildHelpers.java b/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/CProjectBuildHelpers.java
index f0c7959e35..1080a9f27e 100644
--- a/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/CProjectBuildHelpers.java
+++ b/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/CProjectBuildHelpers.java
@@ -60,467 +60,467 @@ import org.eclipse.swt.widgets.Display;
*/
public class CProjectBuildHelpers {
- /**
- * <h1>Custom Project Type enumerator.</h1>
- *
- * <p>
- * Used in conjunction with {@link CProjectBuildHelpers#getProjectType getProjectType} <br>
- * Check the return value against these constants.<br>
- * </p>
- *
- * <p> Can be set to one of the following:
- * - AUTO_TOOLS <br>
- * - MANAGED_MAKEFILE <br>
- * - OTHER <br></p>
- */
- public static enum ProjectBuildType {
- AUTO_TOOLS, MANAGED_MAKEFILE, OTHER
- }
-
- /**
- * <h1>Finds out the type of the project as defined by {@link ProjectBuildType ProjectBuildType}.</h1>
- *
- * <p> A project can be of different types.<br>
- * Common types are:
- * - Autotools<br>
- * - Managed Make project<br>
- * - Manual Makefiles<br></p>
- *
- *
- * <p>
- * Some dialogues (initially in gCov and gProf) distinguish between these when displaying dialogues. This code is used
- * by these dialogues.
- * </p>
- *
- * <p>
- * The method was written with extensibility in mind. <br>
- * Other routines check for autotools/Managed make, and if those are not present, then it shows generic advice about
- * adding flags. MAKEFILE per-se isn't really checked. I.e this means that it should be safe to add additional
- * project types.
- * </p>
- *
- * @param project project for which you want to get the type.
- * @return (enum) projectType : <br>
- * AUTO_TOOLS, <br>
- * MANAGED_MAKEFILE, <br>
- * OTHER <br>
- */
- public static ProjectBuildType getProjectType(IProject project) {
- // AUTOTOOLS
- // Autotools has an 'Autotools' nature by which we can identify it.
- if (isAutoTools(project)) {
- return ProjectBuildType.AUTO_TOOLS;
- }
-
- IConfiguration defaultConfiguration = helperGetActiveConfiguration(project);
- IBuilder builder = defaultConfiguration.getBuilder();
- Boolean projIsManaged = builder.isManagedBuildOn();
-
- // MANAGED PROJECT
- if (projIsManaged) {
- return ProjectBuildType.MANAGED_MAKEFILE;
- }
- else {
- return ProjectBuildType.OTHER; //E.g a manual makefile.
- }
- }
-
- /**
- * <h1>Differentiate C++ from C projects.</h1>
- *
- * <p>
- * Projects can be c or cpp based.<br>
- * Cpp projects have a ccnature as well as a cnature, <br>
- * where as C projects only have a cnature. <br>
- * </p>
- * @param project the IProject project which will be read to check if it is c or cpp.
- * @return true if it has a cpp nature.
- */
- public static boolean isCppType(IProject project) {
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return true;
- }
- else {
- return false;
- }
- } catch (CoreException ex) {
- //This should almost never happen unless the user manually edited the .project file.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
- return false;
- }
- }
-
- /**
- * <h1>Differentiates C from C++ projects.</h1>
- *
- * <p>
- * Projects can be c or cpp based.<br>
- * Cpp projects have a ccnature as well as a cnature, <br>
- * where as C projects only have a cnature.
- * </p>
- * @param project the IProject project which will be read to check if it is c or cpp.
- * @return true if it has a c nature BUT NOT a cpp nature.
- */
- public static boolean isCType(IProject project) {
- try {
- // has C & has not CPP
- if (project.hasNature(CProjectNature.C_NATURE_ID)
- && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return true;
- } else {
- return false;
- }
- } catch (CoreException e) {
- // should never really reach this.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
- return false;
- }
- }
-
- /**
- * <h1>Autotools projects have an Autotools Nature.</h1>
- *
- * @param project IProject that you're dealing with.
- * @return true if the project has an autotools nature.
- */
- public static boolean isAutoTools(IProject project) {
- try {
- if (project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) { // this guy throws.
- return true;
- } else {
- return false;
- }
- } catch (CoreException e) {
- // should never really reach this unless .cproject is broken.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
- return false;
- }
- }
-
- /**
- * <h1>Check if an option is set in the CDT settings.</h1>
- *
- * <p>
- * Commonly used when launching a plugin and you want to check if flags are set correctly.
- * </p>
- *
- * <p>
- * An example of an option id is: {@code gnu.cpp.compiler.option.debugging.gprof } To find the option id, check/uncheck it in
- * your project. Then inspect the .cproject file.
- * </p>
- *
- * <p>
- * This method serves as a model to easily add similar methods. find what subclasses the iPrefernce store, it is
- * likeley that your desired option is in one of those stores.
- * </p>
- * @param project the IProject project which will be read to check if it is c or cpp.
- * @param optionIDString for example <code> gnu.cpp.compiler.option.debugging.codecov </code>
- * @return true if the option is set.
- */
- public static boolean isOptionCheckedInCDT(IProject project, String optionIDString) {
- //Set Tool Name.
- String toolSuperclassId = helperGetToolSuperClassId(project);
- if (toolSuperclassId == null) {
- return false;
- }
- return isOptionCheckedInCDTTool(project, optionIDString, toolSuperclassId);
- }
-
- /**
- * <h1>Check if an option is set</h1>
- * Same as {@link #isOptionCheckedInCDT(IProject project, String optionIDString) isOptionChecked_inCDT },
- * except you specify tool name manually. <br>
- *
- * (e.g you need to check something that's not supported in the implementation above.
- * @param project the IProject project which will be read to check if it is c or cpp
- * @param optionIDString for example <code> gnu.cpp.compiler.option.debugging.codecov </code>
- * @param toolSuperClassId superclass id of the parent tool. see {@link #helperGetToolSuperClassId helper_GetToolSuperClassId}
- * @return true if the option is set
- */
- private static boolean isOptionCheckedInCDTTool(IProject project, String optionIDString, String toolSuperClassId) {
-
- IConfiguration activeConf = helperGetActiveConfiguration(project);
-
- //Get Compiler tool.
- ITool gccCompileriTool = helperGetGccCompilerToolBySuperClass(toolSuperClassId, activeConf);
-
- //(Get immutable option: This is like a 'template' that we will use to get the actual option)
- IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString);
-
- //Check that we got a good option.
- if (optionTemplate == null) {
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate);
- return false;
- }
-
- // Get Actual Option
- // (Now we acquire the actual option from which we can read the value)
- try {
- IOption mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false);
- return (boolean) mutableOptionToSet.getValue();
- } catch (BuildException e) {
- //This is reached if the template that was provided was bad.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting);
- }
- return false;
-
- }
-
- /**
- * <h1> Enable a checkbox in the tools preference store and save to disk.</h1>
- * <p> The tools prefernce store is where most compiler build flags are stored. <br>
- * More specifically for 'debug' flags like gprof and gCov</p>
- *
- * <p>If you don't know how to get your IProject, see example: <br>
- * <code> org.eclipse.linuxtools.internal.gprof.launch.GprofLaunchConfigurationDelegate.getProject() </code></p>
- *
- * <p>Related wiki:
- * <a href="https://wiki.eclipse.org/CDT/Developer/Code_Snippets#Programmatically_set_an_option_in_the_project_settings">
- * Programmaticall check option wiki page. </a></p>
- *
- * @param project
- * I project for which to set the flag
- * @param optionIDString
- * ID of option as defined in plugin.xml. e.g gnu.cpp.compiler.option.debugging.gprof
- * @param value
- * true or false
- * @return false if something went wrong. True otherwise
- */
- public static boolean setOptionInCDT(IProject project, String optionIDString, boolean value) {
- // Set Tool Name.
- String toolSuperClassId = helperGetToolSuperClassId(project);
- if (toolSuperClassId == null) {
- return false;
- }
- return setOptionInCDTTool(project, optionIDString, value, toolSuperClassId);
- }
-
- /**
- * <h1>Set Option in CDT</h1>
- * Same as {@link #setOptionInCDT(IProject project, String optionIDString, boolean value) setOption_in } <br>
- * except you can specify the parent tool manually (in case current implementation does not support what yon need.
- *
- * @param project an IProject
- * @param optionIDString ID of option as defined in plugin.xml. e.g gnu.cpp.compiler.option.debugging.gprof
- * @param value true/false
- * @param toolSuperClassId
- * Name of the tool where the option resides. E.g 'GCC C Compiler' or 'GCC C++ Compiler'. <br>
- * To find out, check/uncheck an option, inspect the .cproject file, look for the option,<br>
- * then see what tool it's under. See the name property
- * @return true if all went well, false otherwise
- */
- private static boolean setOptionInCDTTool(IProject project, String optionIDString, boolean value, String toolSuperClassId) {
-
- // Get configuration
- IConfiguration activeConf = helperGetActiveConfiguration(project);
-
- // Get the ITool the option.
- ITool gccCompileriTool = helperGetGccCompilerToolBySuperClass(toolSuperClassId, activeConf);
-
- // Get Template Opiton.
- //Get Option ~Immutable. This is like a 'templete' that we will base the actual option on.
- IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString);
-
- //Check that we got a good option template.
- if (optionTemplate == null) {
- //This could fail if the specified option doesn't exist or is miss-spelled.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate);
- return false;
- }
-
- // Get Actual Option
- //
- // Now we acquire an option that can be 'set' to something.
- // In contrast to the immutable option above, if the user never checked/unchecked the option by hand,
- // then the first time 'set' of this option will work correctly. Whereas
- // the immutable option would only work if the user checked/unchecked the option by hand before.
- IOption mutableOptionToSet = null;
- try {
- mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false);
- mutableOptionToSet.setValue(value);
- } catch (BuildException e) {
- //This is reached if the template that was provided was bad.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting);
- }
-
- // get resource info. (where things are saved to).
- IResourceInfo resourceInfo = activeConf.getResourceInfos()[0];
-
- // Mark the option as enabled in the build manager.
- ManagedBuildManager.setOption(resourceInfo, gccCompileriTool, mutableOptionToSet,
- true);
-
- // Save this business to disk.
- ManagedBuildManager.saveBuildInfo(project, true);
- return true;
- }
-
- /**
- * <h1>Option enabled check</h1>
- * <p> Check to see if an option is enabled in the .autotools configuration.</p>
- *
- * @param project the IProject project which will be read to check if it is c or cpp.
- * @param optionId copy paste directly from .autotools. pick the 'ID' field value.
- * @return true if it is
- */
- public static boolean isOptionCheckedInAutotoolsPrefStore(final IProject project, final String optionId) {
-
- //We define a 'final' variable that will be accessible in the runnable object.
- final BooleanWithGetSet userChoiceBool = new BooleanWithGetSet(false);
-
- // need to run this in the ui thread otherwise get SWT Exceptions
- // based on concurrency issues.
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
-
- //Code copied from private methd: SetAutotoolsStringOptionValue.setOptionValue()
- //Except I added a line to save the configuration to disk as well.
- AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
- ICConfigurationDescription cfgds = CoreModel.getDefault()
- .getProjectDescription(project).getActiveConfiguration();
- if (cfgds != null) {
- IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance()
- .getConfiguration(project, cfgds.getId());
-
- //Read option value
- IConfigureOption option = iaConfig.getOption(optionId);
- String optValString = option.getValue();
- boolean optVal = Boolean.parseBoolean(optValString);
- userChoiceBool.setVal(optVal);
- }
- }
- });
-
- return userChoiceBool.getVal();
- }
-
- /**
- * <h1>Set Autotools option and write to disk.</h1>
- *
- * <p> Set an option (as well as flags) in the .autotools configuration and update gui. <br>
- * It is oblivious as to whether the option ID is an option or a flag, it just looks at the ID in the xml. </p>
- *
- * <p> It is designed so that it can be ran from a background thread.
- * It syncs with the GUI thread to avoid concurrency exceptions. </p>
- *
- * <p> *this modifies gui checkbox options* <b>as well as</b> *saving the option to disk*. </p>
- *
- * @param project the IProject project which will be read to check if it is c or cpp.
- * @param optId Id of option to set. Take directly out of .autotools. a 'flag' is also an option.
- * @param optVal string value of the option. e.g "true" "1234";
- */
- public static void setOptionInAutotools(final IProject project, final String optId, final String optVal) {
-
- // need to run this in the ui thread otherwise get SWT Exceptions
- // based on concurrency issues.
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
-
- //Code copied from private methd: SetAutotoolsStringOptionValue.setOptionValue()
- //Except I added a line to save the configuration to disk as well.
- AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
- ICConfigurationDescription cfgds = CoreModel.getDefault().
- getProjectDescription(project).getActiveConfiguration();
-
- if (cfgds != null) {
- IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance()
- .getConfiguration(project, cfgds.getId());
-
- //Set option value.
- iaConfig.setOption(optId, optVal);
-
- //Save option to disk.
- AutotoolsConfigurationManager.getInstance().saveConfigs(project);
- }
- }
- });
- }
-
- /**
- * <h1>Trigger a re-build of the project.</h1>
- *
- * <p> Given a project, it finds the active configuration and rebuilds the project. </p>
- *
- * <p> This works with C/C++ Managed Builds as well as Autotools.</p>
- *
- * <p>Most useful for when you have added a flag to a project programmatically and want to rebuild
- * the project so that the program is rebuild with that flag. The Rebuild triggers an update of the makefile
- * automatically.</p>
- *
- * @param project to rebuild
- */
- public static void rebuildProject(IProject project) {
- //rebuild does not generate an analysis file (e.g gmon.out) But since -pg flag is added, profiling support is added to the binary.
- try {
- IBuildConfiguration buildConfiguration = project.getActiveBuildConfig();
-
- //force a full rebuild which is usually needed for when you add profiling flags to the build options.
- project.build(buildConfiguration, IncrementalProjectBuilder.FULL_BUILD, null);
- } catch (CoreException e) {
-
- //This is a very rare occurrence. Usually rebuilds don't fail if they worked the first time.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorRebuilding);
- }
- }
-
- /*
- * PRIVATE HELPERS BELOW
- */
-
- /**
- * <p>Helper to get the active build configuration.</p>
- * @param project IProject for which to get the configuration.
- * @return IConfiguration of that project.
- */
- private static IConfiguration helperGetActiveConfiguration(IProject project) {
- IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- return buildInfo.getDefaultConfiguration();
- }
-
- /**
- * <p> For a project, calculate the expected superclass id of the compiler tool we expect the compiler tool to be under.</p>
- *
- * @param project IProject for which to get the tool superclass id.
- * @return superclass id of the parent tool.
- */
- private static String helperGetToolSuperClassId(IProject project) {
- String superClassId = null;
- if (isCType(project)) {
- superClassId = "cdt.managedbuild.tool.gnu.c.compiler"; //$NON-NLS-1$
- } else if (isCppType(project)) {
- superClassId = "cdt.managedbuild.tool.gnu.cpp.compiler"; //$NON-NLS-1$
- } else {
- //This should happen only if project natures are broken. Maybe the .project file is corrupted.
- MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectToolname);
- return null;
- }
- return superClassId;
- }
-
- /**
- * <h1>Get the tool that has the given id at the top of its superclass chain.</h1>
- *
- * @param superClassId a string representing the expected top-most superclass id of the compiler tool.
- * @param activeConf The current active configuration of the project, from which we should be able to find the ITool.
- * @return the 'ITool' instance.
- */
- private static ITool helperGetGccCompilerToolBySuperClass(String superClassId, IConfiguration activeConf) {
- ITool[] tools = activeConf.getTools();
- ITool gccCompileriTool = null;
- for (ITool iTool : tools) {
- ITool tool = iTool;
- while (tool.getSuperClass() != null) {
- tool = tool.getSuperClass();
- }
- if (tool.getId().equals(superClassId)) {
- gccCompileriTool = iTool;
- break;
- }
- }
- return gccCompileriTool;
- }
+ /**
+ * <h1>Custom Project Type enumerator.</h1>
+ *
+ * <p>
+ * Used in conjunction with {@link CProjectBuildHelpers#getProjectType getProjectType} <br>
+ * Check the return value against these constants.<br>
+ * </p>
+ *
+ * <p> Can be set to one of the following:
+ * - AUTO_TOOLS <br>
+ * - MANAGED_MAKEFILE <br>
+ * - OTHER <br></p>
+ */
+ public static enum ProjectBuildType {
+ AUTO_TOOLS, MANAGED_MAKEFILE, OTHER
+ }
+
+ /**
+ * <h1>Finds out the type of the project as defined by {@link ProjectBuildType ProjectBuildType}.</h1>
+ *
+ * <p> A project can be of different types.<br>
+ * Common types are:
+ * - Autotools<br>
+ * - Managed Make project<br>
+ * - Manual Makefiles<br></p>
+ *
+ *
+ * <p>
+ * Some dialogues (initially in gCov and gProf) distinguish between these when displaying dialogues. This code is used
+ * by these dialogues.
+ * </p>
+ *
+ * <p>
+ * The method was written with extensibility in mind. <br>
+ * Other routines check for autotools/Managed make, and if those are not present, then it shows generic advice about
+ * adding flags. MAKEFILE per-se isn't really checked. I.e this means that it should be safe to add additional
+ * project types.
+ * </p>
+ *
+ * @param project project for which you want to get the type.
+ * @return (enum) projectType : <br>
+ * AUTO_TOOLS, <br>
+ * MANAGED_MAKEFILE, <br>
+ * OTHER <br>
+ */
+ public static ProjectBuildType getProjectType(IProject project) {
+ // AUTOTOOLS
+ // Autotools has an 'Autotools' nature by which we can identify it.
+ if (isAutoTools(project)) {
+ return ProjectBuildType.AUTO_TOOLS;
+ }
+
+ IConfiguration defaultConfiguration = helperGetActiveConfiguration(project);
+ IBuilder builder = defaultConfiguration.getBuilder();
+ Boolean projIsManaged = builder.isManagedBuildOn();
+
+ // MANAGED PROJECT
+ if (projIsManaged) {
+ return ProjectBuildType.MANAGED_MAKEFILE;
+ }
+ else {
+ return ProjectBuildType.OTHER; //E.g a manual makefile.
+ }
+ }
+
+ /**
+ * <h1>Differentiate C++ from C projects.</h1>
+ *
+ * <p>
+ * Projects can be c or cpp based.<br>
+ * Cpp projects have a ccnature as well as a cnature, <br>
+ * where as C projects only have a cnature. <br>
+ * </p>
+ * @param project the IProject project which will be read to check if it is c or cpp.
+ * @return true if it has a cpp nature.
+ */
+ public static boolean isCppType(IProject project) {
+ try {
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ } catch (CoreException ex) {
+ //This should almost never happen unless the user manually edited the .project file.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
+ return false;
+ }
+ }
+
+ /**
+ * <h1>Differentiates C from C++ projects.</h1>
+ *
+ * <p>
+ * Projects can be c or cpp based.<br>
+ * Cpp projects have a ccnature as well as a cnature, <br>
+ * where as C projects only have a cnature.
+ * </p>
+ * @param project the IProject project which will be read to check if it is c or cpp.
+ * @return true if it has a c nature BUT NOT a cpp nature.
+ */
+ public static boolean isCType(IProject project) {
+ try {
+ // has C & has not CPP
+ if (project.hasNature(CProjectNature.C_NATURE_ID)
+ && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (CoreException e) {
+ // should never really reach this.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
+ return false;
+ }
+ }
+
+ /**
+ * <h1>Autotools projects have an Autotools Nature.</h1>
+ *
+ * @param project IProject that you're dealing with.
+ * @return true if the project has an autotools nature.
+ */
+ public static boolean isAutoTools(IProject project) {
+ try {
+ if (project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) { // this guy throws.
+ return true;
+ } else {
+ return false;
+ }
+ } catch (CoreException e) {
+ // should never really reach this unless .cproject is broken.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType);
+ return false;
+ }
+ }
+
+ /**
+ * <h1>Check if an option is set in the CDT settings.</h1>
+ *
+ * <p>
+ * Commonly used when launching a plugin and you want to check if flags are set correctly.
+ * </p>
+ *
+ * <p>
+ * An example of an option id is: {@code gnu.cpp.compiler.option.debugging.gprof } To find the option id, check/uncheck it in
+ * your project. Then inspect the .cproject file.
+ * </p>
+ *
+ * <p>
+ * This method serves as a model to easily add similar methods. find what subclasses the iPrefernce store, it is
+ * likeley that your desired option is in one of those stores.
+ * </p>
+ * @param project the IProject project which will be read to check if it is c or cpp.
+ * @param optionIDString for example <code> gnu.cpp.compiler.option.debugging.codecov </code>
+ * @return true if the option is set.
+ */
+ public static boolean isOptionCheckedInCDT(IProject project, String optionIDString) {
+ //Set Tool Name.
+ String toolSuperclassId = helperGetToolSuperClassId(project);
+ if (toolSuperclassId == null) {
+ return false;
+ }
+ return isOptionCheckedInCDTTool(project, optionIDString, toolSuperclassId);
+ }
+
+ /**
+ * <h1>Check if an option is set</h1>
+ * Same as {@link #isOptionCheckedInCDT(IProject project, String optionIDString) isOptionChecked_inCDT },
+ * except you specify tool name manually. <br>
+ *
+ * (e.g you need to check something that's not supported in the implementation above.
+ * @param project the IProject project which will be read to check if it is c or cpp
+ * @param optionIDString for example <code> gnu.cpp.compiler.option.debugging.codecov </code>
+ * @param toolSuperClassId superclass id of the parent tool. see {@link #helperGetToolSuperClassId helper_GetToolSuperClassId}
+ * @return true if the option is set
+ */
+ private static boolean isOptionCheckedInCDTTool(IProject project, String optionIDString, String toolSuperClassId) {
+
+ IConfiguration activeConf = helperGetActiveConfiguration(project);
+
+ //Get Compiler tool.
+ ITool gccCompileriTool = helperGetGccCompilerToolBySuperClass(toolSuperClassId, activeConf);
+
+ //(Get immutable option: This is like a 'template' that we will use to get the actual option)
+ IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString);
+
+ //Check that we got a good option.
+ if (optionTemplate == null) {
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate);
+ return false;
+ }
+
+ // Get Actual Option
+ // (Now we acquire the actual option from which we can read the value)
+ try {
+ IOption mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false);
+ return (boolean) mutableOptionToSet.getValue();
+ } catch (BuildException e) {
+ //This is reached if the template that was provided was bad.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting);
+ }
+ return false;
+
+ }
+
+ /**
+ * <h1> Enable a checkbox in the tools preference store and save to disk.</h1>
+ * <p> The tools prefernce store is where most compiler build flags are stored. <br>
+ * More specifically for 'debug' flags like gprof and gCov</p>
+ *
+ * <p>If you don't know how to get your IProject, see example: <br>
+ * <code> org.eclipse.linuxtools.internal.gprof.launch.GprofLaunchConfigurationDelegate.getProject() </code></p>
+ *
+ * <p>Related wiki:
+ * <a href="https://wiki.eclipse.org/CDT/Developer/Code_Snippets#Programmatically_set_an_option_in_the_project_settings">
+ * Programmaticall check option wiki page. </a></p>
+ *
+ * @param project
+ * I project for which to set the flag
+ * @param optionIDString
+ * ID of option as defined in plugin.xml. e.g gnu.cpp.compiler.option.debugging.gprof
+ * @param value
+ * true or false
+ * @return false if something went wrong. True otherwise
+ */
+ public static boolean setOptionInCDT(IProject project, String optionIDString, boolean value) {
+ // Set Tool Name.
+ String toolSuperClassId = helperGetToolSuperClassId(project);
+ if (toolSuperClassId == null) {
+ return false;
+ }
+ return setOptionInCDTTool(project, optionIDString, value, toolSuperClassId);
+ }
+
+ /**
+ * <h1>Set Option in CDT</h1>
+ * Same as {@link #setOptionInCDT(IProject project, String optionIDString, boolean value) setOption_in } <br>
+ * except you can specify the parent tool manually (in case current implementation does not support what yon need.
+ *
+ * @param project an IProject
+ * @param optionIDString ID of option as defined in plugin.xml. e.g gnu.cpp.compiler.option.debugging.gprof
+ * @param value true/false
+ * @param toolSuperClassId
+ * Name of the tool where the option resides. E.g 'GCC C Compiler' or 'GCC C++ Compiler'. <br>
+ * To find out, check/uncheck an option, inspect the .cproject file, look for the option,<br>
+ * then see what tool it's under. See the name property
+ * @return true if all went well, false otherwise
+ */
+ private static boolean setOptionInCDTTool(IProject project, String optionIDString, boolean value, String toolSuperClassId) {
+
+ // Get configuration
+ IConfiguration activeConf = helperGetActiveConfiguration(project);
+
+ // Get the ITool the option.
+ ITool gccCompileriTool = helperGetGccCompilerToolBySuperClass(toolSuperClassId, activeConf);
+
+ // Get Template Opiton.
+ //Get Option ~Immutable. This is like a 'templete' that we will base the actual option on.
+ IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString);
+
+ //Check that we got a good option template.
+ if (optionTemplate == null) {
+ //This could fail if the specified option doesn't exist or is miss-spelled.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate);
+ return false;
+ }
+
+ // Get Actual Option
+ //
+ // Now we acquire an option that can be 'set' to something.
+ // In contrast to the immutable option above, if the user never checked/unchecked the option by hand,
+ // then the first time 'set' of this option will work correctly. Whereas
+ // the immutable option would only work if the user checked/unchecked the option by hand before.
+ IOption mutableOptionToSet = null;
+ try {
+ mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false);
+ mutableOptionToSet.setValue(value);
+ } catch (BuildException e) {
+ //This is reached if the template that was provided was bad.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting);
+ }
+
+ // get resource info. (where things are saved to).
+ IResourceInfo resourceInfo = activeConf.getResourceInfos()[0];
+
+ // Mark the option as enabled in the build manager.
+ ManagedBuildManager.setOption(resourceInfo, gccCompileriTool, mutableOptionToSet,
+ true);
+
+ // Save this business to disk.
+ ManagedBuildManager.saveBuildInfo(project, true);
+ return true;
+ }
+
+ /**
+ * <h1>Option enabled check</h1>
+ * <p> Check to see if an option is enabled in the .autotools configuration.</p>
+ *
+ * @param project the IProject project which will be read to check if it is c or cpp.
+ * @param optionId copy paste directly from .autotools. pick the 'ID' field value.
+ * @return true if it is
+ */
+ public static boolean isOptionCheckedInAutotoolsPrefStore(final IProject project, final String optionId) {
+
+ //We define a 'final' variable that will be accessible in the runnable object.
+ final BooleanWithGetSet userChoiceBool = new BooleanWithGetSet(false);
+
+ // need to run this in the ui thread otherwise get SWT Exceptions
+ // based on concurrency issues.
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+
+ //Code copied from private methd: SetAutotoolsStringOptionValue.setOptionValue()
+ //Except I added a line to save the configuration to disk as well.
+ AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
+ ICConfigurationDescription cfgds = CoreModel.getDefault()
+ .getProjectDescription(project).getActiveConfiguration();
+ if (cfgds != null) {
+ IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance()
+ .getConfiguration(project, cfgds.getId());
+
+ //Read option value
+ IConfigureOption option = iaConfig.getOption(optionId);
+ String optValString = option.getValue();
+ boolean optVal = Boolean.parseBoolean(optValString);
+ userChoiceBool.setVal(optVal);
+ }
+ }
+ });
+
+ return userChoiceBool.getVal();
+ }
+
+ /**
+ * <h1>Set Autotools option and write to disk.</h1>
+ *
+ * <p> Set an option (as well as flags) in the .autotools configuration and update gui. <br>
+ * It is oblivious as to whether the option ID is an option or a flag, it just looks at the ID in the xml. </p>
+ *
+ * <p> It is designed so that it can be ran from a background thread.
+ * It syncs with the GUI thread to avoid concurrency exceptions. </p>
+ *
+ * <p> *this modifies gui checkbox options* <b>as well as</b> *saving the option to disk*. </p>
+ *
+ * @param project the IProject project which will be read to check if it is c or cpp.
+ * @param optId Id of option to set. Take directly out of .autotools. a 'flag' is also an option.
+ * @param optVal string value of the option. e.g "true" "1234";
+ */
+ public static void setOptionInAutotools(final IProject project, final String optId, final String optVal) {
+
+ // need to run this in the ui thread otherwise get SWT Exceptions
+ // based on concurrency issues.
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+
+ //Code copied from private methd: SetAutotoolsStringOptionValue.setOptionValue()
+ //Except I added a line to save the configuration to disk as well.
+ AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
+ ICConfigurationDescription cfgds = CoreModel.getDefault().
+ getProjectDescription(project).getActiveConfiguration();
+
+ if (cfgds != null) {
+ IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance()
+ .getConfiguration(project, cfgds.getId());
+
+ //Set option value.
+ iaConfig.setOption(optId, optVal);
+
+ //Save option to disk.
+ AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
+ }
+ });
+ }
+
+ /**
+ * <h1>Trigger a re-build of the project.</h1>
+ *
+ * <p> Given a project, it finds the active configuration and rebuilds the project. </p>
+ *
+ * <p> This works with C/C++ Managed Builds as well as Autotools.</p>
+ *
+ * <p>Most useful for when you have added a flag to a project programmatically and want to rebuild
+ * the project so that the program is rebuild with that flag. The Rebuild triggers an update of the makefile
+ * automatically.</p>
+ *
+ * @param project to rebuild
+ */
+ public static void rebuildProject(IProject project) {
+ //rebuild does not generate an analysis file (e.g gmon.out) But since -pg flag is added, profiling support is added to the binary.
+ try {
+ IBuildConfiguration buildConfiguration = project.getActiveBuildConfig();
+
+ //force a full rebuild which is usually needed for when you add profiling flags to the build options.
+ project.build(buildConfiguration, IncrementalProjectBuilder.FULL_BUILD, null);
+ } catch (CoreException e) {
+
+ //This is a very rare occurrence. Usually rebuilds don't fail if they worked the first time.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorRebuilding);
+ }
+ }
+
+ /*
+ * PRIVATE HELPERS BELOW
+ */
+
+ /**
+ * <p>Helper to get the active build configuration.</p>
+ * @param project IProject for which to get the configuration.
+ * @return IConfiguration of that project.
+ */
+ private static IConfiguration helperGetActiveConfiguration(IProject project) {
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ return buildInfo.getDefaultConfiguration();
+ }
+
+ /**
+ * <p> For a project, calculate the expected superclass id of the compiler tool we expect the compiler tool to be under.</p>
+ *
+ * @param project IProject for which to get the tool superclass id.
+ * @return superclass id of the parent tool.
+ */
+ private static String helperGetToolSuperClassId(IProject project) {
+ String superClassId = null;
+ if (isCType(project)) {
+ superClassId = "cdt.managedbuild.tool.gnu.c.compiler"; //$NON-NLS-1$
+ } else if (isCppType(project)) {
+ superClassId = "cdt.managedbuild.tool.gnu.cpp.compiler"; //$NON-NLS-1$
+ } else {
+ //This should happen only if project natures are broken. Maybe the .project file is corrupted.
+ MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectToolname);
+ return null;
+ }
+ return superClassId;
+ }
+
+ /**
+ * <h1>Get the tool that has the given id at the top of its superclass chain.</h1>
+ *
+ * @param superClassId a string representing the expected top-most superclass id of the compiler tool.
+ * @param activeConf The current active configuration of the project, from which we should be able to find the ITool.
+ * @return the 'ITool' instance.
+ */
+ private static ITool helperGetGccCompilerToolBySuperClass(String superClassId, IConfiguration activeConf) {
+ ITool[] tools = activeConf.getTools();
+ ITool gccCompileriTool = null;
+ for (ITool iTool : tools) {
+ ITool tool = iTool;
+ while (tool.getSuperClass() != null) {
+ tool = tool.getSuperClass();
+ }
+ if (tool.getId().equals(superClassId)) {
+ gccCompileriTool = iTool;
+ break;
+ }
+ }
+ return gccCompileriTool;
+ }
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/ProfileUIUtils.java b/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/ProfileUIUtils.java
index ab3fc2dacc..2748edac00 100644
--- a/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/ProfileUIUtils.java
+++ b/profiling/org.eclipse.linuxtools.profiling.ui/src/org/eclipse/linuxtools/profiling/ui/ProfileUIUtils.java
@@ -89,37 +89,37 @@ public class ProfileUIUtils {
}
}
- /**
- * Open a file in the Editor at the specified offset, highlighting the given length
- *
- * @param path : Absolute path pointing to the file which will be opened.
- * @param line - line number to select, 0 to not select a line
- * @param project - current project object
- * @throws BadLocationException - Line number not valid in file
- * @throws PartInitException if the editor could not be initialized
- * @throws CoreException if the proxy cannot be initialized
- * @since 3.1
- */
- public static void openEditorAndSelect(String path, int line, IProject project) throws PartInitException, BadLocationException, CoreException {
- IWorkbenchPage activePage = ProfileUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IRemoteFileProxy proxy = null;
- proxy = RemoteProxyManager.getInstance().getFileProxy(project);
- IFileStore file = proxy.getResource(path);
- if (file.fetchInfo().exists()) {
- IEditorPart editor = IDE.openEditorOnFileStore(activePage, file);
- if (editor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) editor;
-
- if (line > 0) {
- IDocumentProvider provider = textEditor.getDocumentProvider();
- IDocument document = provider.getDocument(textEditor.getEditorInput());
-
- int start = document.getLineOffset(line - 1); //zero-indexed
- textEditor.selectAndReveal(start, 0);
- }
- }
- }
- }
+ /**
+ * Open a file in the Editor at the specified offset, highlighting the given length
+ *
+ * @param path : Absolute path pointing to the file which will be opened.
+ * @param line - line number to select, 0 to not select a line
+ * @param project - current project object
+ * @throws BadLocationException - Line number not valid in file
+ * @throws PartInitException if the editor could not be initialized
+ * @throws CoreException if the proxy cannot be initialized
+ * @since 3.1
+ */
+ public static void openEditorAndSelect(String path, int line, IProject project) throws PartInitException, BadLocationException, CoreException {
+ IWorkbenchPage activePage = ProfileUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IRemoteFileProxy proxy = null;
+ proxy = RemoteProxyManager.getInstance().getFileProxy(project);
+ IFileStore file = proxy.getResource(path);
+ if (file.fetchInfo().exists()) {
+ IEditorPart editor = IDE.openEditorOnFileStore(activePage, file);
+ if (editor instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) editor;
+
+ if (line > 0) {
+ IDocumentProvider provider = textEditor.getDocumentProvider();
+ IDocument document = provider.getDocument(textEditor.getEditorInput());
+
+ int start = document.getLineOffset(line - 1); //zero-indexed
+ textEditor.selectAndReveal(start, 0);
+ }
+ }
+ }
+ }
/**
diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTProxyManager.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTProxyManager.java
index 5e86204ec1..2aef64c2f0 100644
--- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTProxyManager.java
+++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTProxyManager.java
@@ -98,12 +98,12 @@ public class RDTProxyManager implements IRemoteEnvProxyManager {
Map<String, String> envMap = new HashMap<>();
Map<String, String> envTemp = connection.getEnv();
for (String key : envTemp.keySet()) {
- String value = envTemp.get(key);
- String env = key + "=" + value; //$NON-NLS-1$
- m = functionPattern.matcher(env);
- if (!m.matches()) {
- envMap.put(key, value);
- }
+ String value = envTemp.get(key);
+ String env = key + "=" + value; //$NON-NLS-1$
+ m = functionPattern.matcher(env);
+ if (!m.matches()) {
+ envMap.put(key, value);
+ }
}
return envMap;
}
diff --git a/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/Messages.java b/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/Messages.java
index 0e31c5f518..574222d63c 100644
--- a/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/Messages.java
+++ b/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/Messages.java
@@ -13,41 +13,41 @@ package org.eclipse.linuxtools.internal.ssh.proxy;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.ssh.proxy.messages"; //$NON-NLS-1$
- public static String SSHFileStore_attrFailed;
- public static String SSHFileStore_attrMonitor;
- public static String SSHFileStore_childInfoFailed;
- public static String SSHFileStore_childInfoFailedDirectory;
- public static String SSHFileStore_childInfoMonitor;
- public static String SSHFileStore_childNamesFailed;
- public static String SSHFileStore_childNamesFailedDirectory;
- public static String SSHFileStore_childNamesMonitor;
- public static String SSHFileStore_childStoresFailed;
- public static String SSHFileStore_childStoresFailedDirectory;
- public static String SSHFileStore_childStoresMonitor;
- public static String SSHFileStore_getInputStreamFailed;
- public static String SSHFileStore_getInputStreamMonitor;
- public static String SSHFileStore_getOutputStreamFailed;
- public static String SSHFileStore_getOutputStreamMonitor;
- public static String SSHFileStore_mkdirFailed;
- public static String SSHFileStore_mkdirMonitor;
- public static String SSHFileStore_putInfoFailed;
- public static String SSHFileStore_putInfoMonitor;
- public static String SSHFileStore_rmFailed;
- public static String SSHFileStore_rmMonitor;
- public static String SSHCommandLauncher_malformed_env_var_string;
- public static String SSHBase_CreateSessionFailed;
- public static String SSHBase_CreateSessionCancelled;
- public static String SSHPasswordDialog_Password;
- public static String SSHPasswordDialog_Password_Title;
- public static String SSHPasswordDialog_Title;
- public static String SSHCommandLauncher_execution_problem;
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.ssh.proxy.messages"; //$NON-NLS-1$
+ public static String SSHFileStore_attrFailed;
+ public static String SSHFileStore_attrMonitor;
+ public static String SSHFileStore_childInfoFailed;
+ public static String SSHFileStore_childInfoFailedDirectory;
+ public static String SSHFileStore_childInfoMonitor;
+ public static String SSHFileStore_childNamesFailed;
+ public static String SSHFileStore_childNamesFailedDirectory;
+ public static String SSHFileStore_childNamesMonitor;
+ public static String SSHFileStore_childStoresFailed;
+ public static String SSHFileStore_childStoresFailedDirectory;
+ public static String SSHFileStore_childStoresMonitor;
+ public static String SSHFileStore_getInputStreamFailed;
+ public static String SSHFileStore_getInputStreamMonitor;
+ public static String SSHFileStore_getOutputStreamFailed;
+ public static String SSHFileStore_getOutputStreamMonitor;
+ public static String SSHFileStore_mkdirFailed;
+ public static String SSHFileStore_mkdirMonitor;
+ public static String SSHFileStore_putInfoFailed;
+ public static String SSHFileStore_putInfoMonitor;
+ public static String SSHFileStore_rmFailed;
+ public static String SSHFileStore_rmMonitor;
+ public static String SSHCommandLauncher_malformed_env_var_string;
+ public static String SSHBase_CreateSessionFailed;
+ public static String SSHBase_CreateSessionCancelled;
+ public static String SSHPasswordDialog_Password;
+ public static String SSHPasswordDialog_Password_Title;
+ public static String SSHPasswordDialog_Title;
+ public static String SSHCommandLauncher_execution_problem;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
- private Messages() {
- }
+ private Messages() {
+ }
}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/Messages.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/Messages.java
index eb9eb43879..b6132d924c 100644
--- a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/Messages.java
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/Messages.java
@@ -14,18 +14,18 @@ package org.eclipse.linuxtools.internal.tools.launch.ui.properties;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.tools.launch.ui.properties.messages"; //$NON-NLS-1$
- public static String LINUXTOOLS_PATH;
- public static String LINUXTOOLS_PATH_COMBO;
- public static String LINUXTOOLS_PATH_CUSTOM;
- public static String LINUXTOOLS_PATH_CUSTOM_TOOLTIP;
- public static String LINUXTOOLS_PATH_SYSTEM_ENV;
- public static String LINUXTOOLS_PATH_TOOLTIP;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.tools.launch.ui.properties.messages"; //$NON-NLS-1$
+ public static String LINUXTOOLS_PATH;
+ public static String LINUXTOOLS_PATH_COMBO;
+ public static String LINUXTOOLS_PATH_CUSTOM;
+ public static String LINUXTOOLS_PATH_CUSTOM_TOOLTIP;
+ public static String LINUXTOOLS_PATH_SYSTEM_ENV;
+ public static String LINUXTOOLS_PATH_TOOLTIP;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
- private Messages() {
- }
+ private Messages() {
+ }
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
index 408805f95f..ea681ea9b9 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java
@@ -357,7 +357,7 @@ public class MetadataPage extends FormPage {
public void widgetSelected(SelectionEvent e) {
addTag();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent e) {
addTag();
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java
index 28cc341ea0..f08559b6b2 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java
@@ -93,7 +93,7 @@ public class RepoFormEditor extends FormEditor {
/**
* Creates page for importing RPMs from the workspace or the file system.
- *
+ *
* @throws PartInitException
*/
private void createImportsPage() throws PartInitException {
@@ -105,7 +105,7 @@ public class RepoFormEditor extends FormEditor {
* Creates page allowing the user to modify some of the data in the
* repomd.xml as well as some options when customizing the execution of the
* createrepo command. The default execution would satisfy most users.
- *
+ *
* @throws PartInitException
*/
private void createMetadataPage() throws PartInitException {
@@ -115,7 +115,7 @@ public class RepoFormEditor extends FormEditor {
/**
* Creates editor for the current .repo file.
- *
+ *
* @throws PartInitException
*/
private void createEditorPage() throws PartInitException {
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java
index ab56f6255d..537023daf7 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java
@@ -74,12 +74,12 @@ public final class RpmPackageBuildProposalsJob extends Job {
protected static final IPropertyChangeListener PROPERTY_LISTENER = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(PreferenceConstants.P_CURRENT_RPMTOOLS)) {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(PreferenceConstants.P_CURRENT_RPMTOOLS)) {
update();
}
- }
+ }
};
protected static final IPreferenceStore STORE = Activator.getDefault().getPreferenceStore();
@@ -247,9 +247,9 @@ public final class RpmPackageBuildProposalsJob extends Job {
*/
public static void setPropertyChangeListener(boolean activated) {
if (activated) {
- STORE.addPropertyChangeListener(PROPERTY_LISTENER);
+ STORE.addPropertyChangeListener(PROPERTY_LISTENER);
} else {
- STORE.removePropertyChangeListener(PROPERTY_LISTENER);
+ STORE.removePropertyChangeListener(PROPERTY_LISTENER);
}
}
diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java
index 8a7de9db42..04f6b4a96d 100644
--- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java
+++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java
@@ -37,14 +37,14 @@ public class PerlMakefileParser {
*
*/
private static final String WHITE_SPACE = "(?:\\s+)";
- private static final String COMMENT = "#.+"; // # comment
- private static final String LINE_WITH_COMMENT = "(?:(.*)#.+)"; // line # comment
+ private static final String COMMENT = "#.+"; // # comment
+ private static final String LINE_WITH_COMMENT = "(?:(.*)#.+)"; // line # comment
private static final String VARIABLE_PARAMS = "(?:my|local|our)";
- private static final String WORD = "(\\b\\w+\\b)"; // variable
+ private static final String WORD = "(\\b\\w+\\b)"; // variable
private static final String NON_WHITE_SPACE = "(\\S+)";
private static final String VARIABLE = "(?:" + VARIABLE_PARAMS
- + WHITE_SPACE + ")?(?:\\$|@|%)" + WORD + WHITE_SPACE + "?"; // %variable | my $variable | our @variable
+ + WHITE_SPACE + ")?(?:\\$|@|%)" + WORD + WHITE_SPACE + "?"; // %variable | my $variable | our @variable
private static final String ASSOCIATIVE_KEY = WHITE_SPACE + "?"
+ NON_WHITE_SPACE + WHITE_SPACE + "?";
@@ -54,16 +54,16 @@ public class PerlMakefileParser {
private static final String ASSOCIATIVE_OPERATOR = "=>";
private static final String SIMPLE_ASSIGNMENT = NON_CONDITIONAL
+ WHITE_SPACE + "?" + VARIABLE + "(?:" + ASSIGNMENT_OPERATOR + ")"
- + EXCLUDE_SPECIALS + "(?:(.+))"; // %var = value || [1] = [2]
+ + EXCLUDE_SPECIALS + "(?:(.+))"; // %var = value || [1] = [2]
private static final String ASSOCIATIVE_ASSIGNMENT = ASSOCIATIVE_KEY
- + ASSOCIATIVE_OPERATOR + "(?:(.+))"; // 'key' => 'value' || [1] => [2]
+ + ASSOCIATIVE_OPERATOR + "(?:(.+))"; // 'key' => 'value' || [1] => [2]
private static final String FUNCTION = "\\s*" + WORD
- + "*\\s*?\\((.*)\\)\\s*"; // foo(bar) | foo(foo(bar)) | foo() || [1]([2])
- private static final String BEGIN_END = "(?:[^#]*<<END)"; // [CS] test<<END | <<END
- private static final String END_END = "^END$"; // [CS]
- private static final String BEGIN_BC = "^=(?!cut)[a-z]\\S+(\\s)?\\S+"; // [CS] =test | =test test
- private static final String END_BC = "^=cut$"; // [CS]
+ + "*\\s*?\\((.*)\\)\\s*"; // foo(bar) | foo(foo(bar)) | foo() || [1]([2])
+ private static final String BEGIN_END = "(?:[^#]*<<END)"; // [CS] test<<END | <<END
+ private static final String END_END = "^END$"; // [CS]
+ private static final String BEGIN_BC = "^=(?!cut)[a-z]\\S+(\\s)?\\S+"; // [CS] =test | =test test
+ private static final String END_BC = "^=cut$"; // [CS]
private static final String MAKEFILE_FUNCTION_NAME = "WriteMakefile";
private static final String MAKEFILE_FUNCTION = "^.*"
diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java
index 30dff65b5d..097f153f3b 100644
--- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java
+++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java
@@ -34,15 +34,15 @@ public class RubyGemParser {
private Map<String, ArrayList<String>> mSetupDependencies;
private static final String SETUP_START = "^gem[:\\.]{1,2}specification[:\\.]{1,2}new(\\s+)?do(\\s+)?\\|(\\s+)?(\\w+)(\\s+)?\\|";
- private static final String STRING = "(?:\\\"([^\\\"]+)\\\"|'([^']+)'|(?:%q|%Q)(?:([^\\w])([^/3].+)[^\\w]))"; // (%q|%Q) "value" | 'value' | {value}
- private static final String LIST = "(?!%q|%Q)(?:%w|%W)?(?:([\\W])(.+)[\\W])"; // (%w|%W) [value, value2] | {"value", "value2"}
- private static final String STRING_LIST = "(?:\\\"([^\\\"]+)\\\"|'([^']+)')(?:[, ])??"; // "test", "test2" | 'test' 'test2'
- private static final String GENERIC_LIST = "(?:\\S+)(?:\\s+)??"; // test, test2 | test test2
+ private static final String STRING = "(?:\\\"([^\\\"]+)\\\"|'([^']+)'|(?:%q|%Q)(?:([^\\w])([^/3].+)[^\\w]))"; // (%q|%Q) "value" | 'value' | {value}
+ private static final String LIST = "(?!%q|%Q)(?:%w|%W)?(?:([\\W])(.+)[\\W])"; // (%w|%W) [value, value2] | {"value", "value2"}
+ private static final String STRING_LIST = "(?:\\\"([^\\\"]+)\\\"|'([^']+)')(?:[, ])??"; // "test", "test2" | 'test' 'test2'
+ private static final String GENERIC_LIST = "(?:\\S+)(?:\\s+)??"; // test, test2 | test test2
private static final String REPLACE_ME = "(%REPLACE_ME)";
- private String simpleDefineRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?=(?!=)(\\s+)?(.*)"; // gem.variable = ...
- private String genericDefineRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?(.*)"; // gem.variable...
- private String simpleFunctionRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?(?:\\((.*)\\))(.*)?"; // gem.variable(...)
+ private String simpleDefineRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?=(?!=)(\\s+)?(.*)"; // gem.variable = ...
+ private String genericDefineRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?(.*)"; // gem.variable...
+ private String simpleFunctionRx = "(\\s+)?(?!#)(?:\\b(%REPLACE_ME)\\b\\.(\\w+))(\\s+)?(?:\\((.*)\\))(.*)?"; // gem.variable(...)
/**
* Initialize
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java
index 61d8c2f0ce..9d45b0e37f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/AbstractChartWithAxisBuilder.java
@@ -116,7 +116,7 @@ public abstract class AbstractChartWithAxisBuilder extends AbstractChartBuilder
@Override
protected void createChart() {
- super.createChart();
+ super.createChart();
applyTitleBoundsListener();
chartMouseMoveListener = new ChartWithAxisMouseMoveListener(chart, chart.getPlotArea());
}
@@ -126,50 +126,51 @@ public abstract class AbstractChartWithAxisBuilder extends AbstractChartBuilder
* @since 3.0
*/
protected void applyTitleBoundsListener() {
- ITitle title = chart.getTitle();
- // Underlying SWT Chart implementation changes from the title being a Control to just
- // a PaintListener. In the Control class case, we can move it's location to
- // center over a PieChart, but in the latter case, we need to alter the title
- // with blanks in the PaintListener and have the title paint after it
- // once the title has been altered.
- if (title instanceof Control) {
- titleBoundsPaintListener = new PaintListener() {
+ ITitle title = chart.getTitle();
+ // Underlying SWT Chart implementation changes from the title being a Control to just
+ // a PaintListener. In the Control class case, we can move it's location to
+ // center over a PieChart, but in the latter case, we need to alter the title
+ // with blanks in the PaintListener and have the title paint after it
+ // once the title has been altered.
+ if (title instanceof Control) {
+ titleBoundsPaintListener = new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- Rectangle bounds = chart.getPlotArea().getBounds();
- Control title = (Control) chart.getTitle();
- Rectangle titleBounds = title.getBounds();
- title.setLocation(new Point(bounds.x + (bounds.width - titleBounds.width) / 2, title.getLocation().y));
- }
- };
- chart.addPaintListener(titleBoundsPaintListener);
- } else {
- // move title paint listener to end
- chart.removePaintListener((PaintListener)title);
- titleBoundsPaintListener = new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle bounds = chart.getPlotArea().getBounds();
+ Control title = (Control) chart.getTitle();
+ Rectangle titleBounds = title.getBounds();
+ title.setLocation(new Point(bounds.x + (bounds.width - titleBounds.width) / 2, title.getLocation().y));
+ }
+ };
+ chart.addPaintListener(titleBoundsPaintListener);
+ } else {
+ // move title paint listener to end
+ chart.removePaintListener((PaintListener)title);
+ titleBoundsPaintListener = new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- ITitle title = chart.getTitle();
- Font font = title.getFont();
- Font oldFont = e.gc.getFont();
- e.gc.setFont(font);
- Control legend = (Control)chart.getLegend();
- Rectangle legendBounds = legend.getBounds();
- int adjustment = legendBounds.width - 15;
- Point blankSize = e.gc.textExtent(" "); //$NON-NLS-1$
- int numBlanks = ((adjustment / blankSize.x) >> 1) << 1;
- String text = title.getText().trim();
- for (int i = 0; i < numBlanks; ++i)
- text += " "; //$NON-NLS-1$
- e.gc.setFont(oldFont);
- title.setText(text);
- }
- };
- chart.addPaintListener(titleBoundsPaintListener);
- chart.addPaintListener((PaintListener)title);
- }
+ @Override
+ public void paintControl(PaintEvent e) {
+ ITitle title = chart.getTitle();
+ Font font = title.getFont();
+ Font oldFont = e.gc.getFont();
+ e.gc.setFont(font);
+ Control legend = (Control)chart.getLegend();
+ Rectangle legendBounds = legend.getBounds();
+ int adjustment = legendBounds.width - 15;
+ Point blankSize = e.gc.textExtent(" "); //$NON-NLS-1$
+ int numBlanks = ((adjustment / blankSize.x) >> 1) << 1;
+ String text = title.getText().trim();
+ for (int i = 0; i < numBlanks; ++i) {
+ text += " "; //$NON-NLS-1$
+ }
+ e.gc.setFont(oldFont);
+ title.setText(text);
+ }
+ };
+ chart.addPaintListener(titleBoundsPaintListener);
+ chart.addPaintListener((PaintListener)title);
+ }
}
/**
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java
index d89cc97e9c..779503c372 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/widgets/Messages.java
@@ -37,12 +37,12 @@ public class Messages extends NLS {
public static String GraphDiscreteXControl_Last;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String GraphCompositeTitle;
/**
- * @since 3.1
- */
+ * @since 3.1
+ */
public static String GraphCompositeLegend;
static {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
index 49f72f4152..aa504aa46a 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
@@ -432,7 +432,7 @@ public class ScriptConsole extends IOConsole {
/**
* Add observer to the script console.
- *
+ *
* @param observer The observer to be added.
* @since 2.0
*/
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java
index 18e26ffc14..bc4687f92f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/PathEditorInput.java
@@ -18,8 +18,6 @@ import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.ide.FileStoreEditorInput;
-
-
public class PathEditorInput extends FileStoreEditorInput implements IPathEditorInput, ILocationProvider {
private IPath fPath;
@@ -70,6 +68,7 @@ public class PathEditorInput extends FileStoreEditorInput implements IPathEditor
return null;
}
+ @SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (PathEditorInput.class.equals(adapter)
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindParserUtils.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindParserUtils.java
index cd1dafad98..f974295832 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindParserUtils.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/ValgrindParserUtils.java
@@ -49,7 +49,7 @@ public final class ValgrindParserUtils {
* @param line - the line to parse
* @param delim - the DELIMITER to separate fields
* @return String value of ARGUMENT
- * @throws IOException If parsing failed.
+ * @throws IOException If parsing failed.
*/
public static String parseStrValue(String line, String delim)
throws IOException {

Back to the top