mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
526750dc20
79 changed files with 1467 additions and 736 deletions
|
@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
*/
|
*/
|
||||||
public class AutotoolsProblemMarkerInfo {
|
public class AutotoolsProblemMarkerInfo {
|
||||||
|
|
||||||
public static enum Type{PACKAGE, HEADER, PROG, FILE, GENERIC}
|
public static enum Type{PACKAGE, HEADER, PROG, LIB, FILE, GENERIC}
|
||||||
|
|
||||||
private ProblemMarkerInfo marker;
|
private ProblemMarkerInfo marker;
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,8 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
return AutotoolsProblemMarkerInfo.Type.HEADER;
|
return AutotoolsProblemMarkerInfo.Type.HEADER;
|
||||||
if (typeString.equals("file"))
|
if (typeString.equals("file"))
|
||||||
return AutotoolsProblemMarkerInfo.Type.FILE;
|
return AutotoolsProblemMarkerInfo.Type.FILE;
|
||||||
|
if (typeString.equals("lib"))
|
||||||
|
return AutotoolsProblemMarkerInfo.Type.LIB;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2522,7 +2522,13 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
|
||||||
* The function never returns number smaller than 1.
|
* The function never returns number smaller than 1.
|
||||||
*/
|
*/
|
||||||
public int getOptimalParallelJobNum() {
|
public int getOptimalParallelJobNum() {
|
||||||
return Runtime.getRuntime().availableProcessors();
|
// Bug 398426: On my Mac running parallel builds at full tilt hangs the desktop.
|
||||||
|
// Need to pull it back one.
|
||||||
|
int j = Runtime.getRuntime().availableProcessors();
|
||||||
|
if (j > 1 && Platform.getOS().equals(Platform.OS_MACOSX))
|
||||||
|
return j - 1;
|
||||||
|
else
|
||||||
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2011 Andrew Gvozdev and others.
|
* Copyright (c) 2009, 2013 Andrew Gvozdev and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,9 @@
|
||||||
package org.eclipse.cdt.managedbuilder.internal.language.settings.providers;
|
package org.eclipse.cdt.managedbuilder.internal.language.settings.providers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -59,7 +61,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
languageSettings = getLanguageSettings(rcDescription);
|
languageSettings = getLanguageSettings(rcDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
Set<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
if (languageSettings != null) {
|
if (languageSettings != null) {
|
||||||
for (ICLanguageSetting langSetting : languageSettings) {
|
for (ICLanguageSetting langSetting : languageSettings) {
|
||||||
|
@ -86,8 +88,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$
|
String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$
|
||||||
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, entry.getFlags());
|
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, entry.getFlags());
|
||||||
if (! list.contains(projectRootedEntry)) {
|
if (!set.contains(projectRootedEntry)) {
|
||||||
list.add(projectRootedEntry);
|
set.add(projectRootedEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
|
@ -97,8 +99,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! list.contains(entry)) {
|
if (!set.contains(entry)) {
|
||||||
list.add(entry);
|
set.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +109,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LanguageSettingsStorage.getPooledList(list);
|
return LanguageSettingsStorage.getPooledList(new ArrayList<ICLanguageSettingEntry>(set));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ BuilderSettingsTab_8=&Expand Env. Variable Refs in Makefiles
|
||||||
BuilderSettingsTab_9=Build settings
|
BuilderSettingsTab_9=Build settings
|
||||||
BuilderSettingsTab_10=Stop on first build error
|
BuilderSettingsTab_10=Stop on first build error
|
||||||
BuilderSettingsTab_EnableParallelBuild=Enable parallel build
|
BuilderSettingsTab_EnableParallelBuild=Enable parallel build
|
||||||
BuilderSettingsTab_UseOptimalJobs=Use number of processors ({0})
|
BuilderSettingsTab_UseOptimalJobs=Use optimal jobs ({0})
|
||||||
BuilderSettingsTab_UseParallelJobs=Use parallel jobs:
|
BuilderSettingsTab_UseParallelJobs=Use parallel jobs:
|
||||||
BuilderSettingsTab_UseUnlimitedJobs=Use unlimited jobs
|
BuilderSettingsTab_UseUnlimitedJobs=Use unlimited jobs
|
||||||
BuilderSettingsTab_14=Workbench Build Behavior
|
BuilderSettingsTab_14=Workbench Build Behavior
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %fragmentName.aix
|
Bundle-Name: %fragmentName.aix
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.aix; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.core.aix; singleton:=true
|
||||||
Bundle-Version: 5.1.1.qualifier
|
Bundle-Version: 5.3.0.qualifier
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Fragment-Host: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)"
|
Fragment-Host: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)"
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -7,14 +7,21 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/* Inaccessible static: hasPTY */
|
|
||||||
/*
|
/*
|
||||||
* Class: org_eclipse_cdt_utils_pty_PTY
|
* Class: org_eclipse_cdt_utils_pty_PTY
|
||||||
* Method: openMaster
|
* Method: openMaster
|
||||||
* Signature: ()Ljava/lang/String;
|
* Signature: (Z)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
|
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
|
||||||
(JNIEnv *, jobject);
|
(JNIEnv *, jobject, jboolean);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_eclipse_cdt_utils_pty_PTY
|
||||||
|
* Method: change_window_size
|
||||||
|
* Signature: (III)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
|
||||||
|
(JNIEnv *, jobject, jint, jint, jint);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
|
||||||
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;I)I
|
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint);
|
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint, jboolean);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
* Class: org_eclipse_cdt_utils_spawner_Spawner
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -17,6 +18,12 @@
|
||||||
|
|
||||||
extern pid_t exec0(const char *path, char *const argv[],
|
extern pid_t exec0(const char *path, char *const argv[],
|
||||||
char *const envp[], const char *dirpath,
|
char *const envp[], const char *dirpath,
|
||||||
int channels[3] );
|
int channels[3]);
|
||||||
|
|
||||||
|
|
||||||
|
extern pid_t exec_pty(const char *path, char *const argv[],
|
||||||
|
char *const envp[], const char *dirpath,
|
||||||
|
int channels[3], const char *pts_name, int fdm,
|
||||||
|
int console);
|
||||||
|
|
||||||
extern int wait0(pid_t pid);
|
extern int wait0(pid_t pid);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004 QNX Software Systems and others.
|
* Copyright (c) 2004, 2013 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
|
@ -20,11 +21,11 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
/* from pfind.c */
|
/* from pfind.c */
|
||||||
extern char *pfind(const char *name);
|
extern char *pfind(const char *name, char * const envp[]);
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
exec_pty(const char *path, char *const argv[], char *const envp[],
|
exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
const char *dirpath, int channels[3], const char *pts_name, int fdm)
|
const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
|
||||||
{
|
{
|
||||||
int pipe2[2];
|
int pipe2[2];
|
||||||
pid_t childpid;
|
pid_t childpid;
|
||||||
|
@ -34,7 +35,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
* We use pfind() to check that the program exists and is an executable.
|
* We use pfind() to check that the program exists and is an executable.
|
||||||
* If not pass the error up. Also execve() wants a full path.
|
* If not pass the error up. Also execve() wants a full path.
|
||||||
*/
|
*/
|
||||||
full_path = pfind(path);
|
full_path = pfind(path, envp);
|
||||||
if (full_path == NULL) {
|
if (full_path == NULL) {
|
||||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -43,7 +44,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
/*
|
/*
|
||||||
* Make sure we can create our pipes before forking.
|
* Make sure we can create our pipes before forking.
|
||||||
*/
|
*/
|
||||||
if (channels != NULL) {
|
if (channels != NULL && console) {
|
||||||
if (pipe(pipe2) < 0) {
|
if (pipe(pipe2) < 0) {
|
||||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||||
free(full_path);
|
free(full_path);
|
||||||
|
@ -64,6 +65,11 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
if (channels != NULL) {
|
if (channels != NULL) {
|
||||||
int fds;
|
int fds;
|
||||||
|
|
||||||
|
if (!console && setsid() < 0) {
|
||||||
|
perror("setsid()");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
fds = ptys_open(fdm, pts_name);
|
fds = ptys_open(fdm, pts_name);
|
||||||
if (fds < 0) {
|
if (fds < 0) {
|
||||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||||
|
@ -71,17 +77,28 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the read end of pipe2 */
|
/* Close the read end of pipe2 */
|
||||||
if (close(pipe2[0]) == -1)
|
if (console && close(pipe2[0]) == -1)
|
||||||
perror("close(pipe2[0]))");
|
perror("close(pipe2[0]))");
|
||||||
|
|
||||||
/* close the master, no need in the child */
|
/* close the master, no need in the child */
|
||||||
close(fdm);
|
close(fdm);
|
||||||
|
|
||||||
|
if (console) {
|
||||||
set_noecho(fds);
|
set_noecho(fds);
|
||||||
|
if (setpgid(getpid(), getpid()) < 0) {
|
||||||
|
perror("setpgid()");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* redirections */
|
/* redirections */
|
||||||
dup2(fds, STDIN_FILENO); /* dup stdin */
|
dup2(fds, STDIN_FILENO); /* dup stdin */
|
||||||
dup2(fds, STDOUT_FILENO); /* dup stdout */
|
dup2(fds, STDOUT_FILENO); /* dup stdout */
|
||||||
|
if (console) {
|
||||||
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
||||||
|
} else {
|
||||||
|
dup2(fds, STDERR_FILENO); /* dup stderr */
|
||||||
|
}
|
||||||
close(fds); /* done with fds. */
|
close(fds); /* done with fds. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,16 +121,20 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
|
|
||||||
} else if (childpid != 0) { /* parent */
|
} else if (childpid != 0) { /* parent */
|
||||||
|
|
||||||
|
if (console) {
|
||||||
set_noecho(fdm);
|
set_noecho(fdm);
|
||||||
|
}
|
||||||
if (channels != NULL) {
|
if (channels != NULL) {
|
||||||
|
channels[0] = fdm; /* Input Stream. */
|
||||||
|
channels[1] = fdm; /* Output Stream. */
|
||||||
|
if (console) {
|
||||||
/* close the write end of pipe1 */
|
/* close the write end of pipe1 */
|
||||||
if (close(pipe2[1]) == -1)
|
if (close(pipe2[1]) == -1)
|
||||||
perror("close(pipe2[1])");
|
perror("close(pipe2[1])");
|
||||||
|
|
||||||
channels[0] = fdm; /* Input Stream. */
|
|
||||||
channels[1] = fdm; /* Output Stream. */
|
|
||||||
channels[2] = pipe2[0]; /* stderr Stream. */
|
channels[2] = pipe2[0]; /* stderr Stream. */
|
||||||
/*channels[2] = fdm; Input Stream. */
|
} else {
|
||||||
|
channels[2] = fdm; /* Error Stream. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(full_path);
|
free(full_path);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* from pfind.c */
|
/* from pfind.c */
|
||||||
extern char *pfind(const char *name);
|
extern char *pfind(const char *name, char * const envp[]);
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
exec0(const char *path, char *const argv[], char *const envp[],
|
exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
|
@ -33,7 +34,7 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
* We use pfind() to check that the program exists and is an executable.
|
* We use pfind() to check that the program exists and is an executable.
|
||||||
* If not pass the error up. Also execve() wants a full path.
|
* If not pass the error up. Also execve() wants a full path.
|
||||||
*/
|
*/
|
||||||
full_path = pfind(path);
|
full_path = pfind(path, envp);
|
||||||
if (full_path == NULL) {
|
if (full_path == NULL) {
|
||||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -91,6 +92,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
close(fd++);
|
close(fd++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setpgid(getpid(), getpid());
|
||||||
|
|
||||||
if (envp[0] == NULL) {
|
if (envp[0] == NULL) {
|
||||||
execv(full_path, argv);
|
execv(full_path, argv);
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,9 +138,19 @@ int wait0(pid_t pid)
|
||||||
int status;
|
int status;
|
||||||
int val = -1;
|
int val = -1;
|
||||||
|
|
||||||
if (pid < 0 || waitpid(pid, &status, 0) < 0)
|
if (pid < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (waitpid(pid, &status, 0) < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
// interrupted system call - retry
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
val = WEXITSTATUS(status);
|
val = WEXITSTATUS(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ptym_open (char *pts_name);
|
int ptym_open (char *pts_name);
|
||||||
int ptys_open (int fdm, char * pts_name);
|
int ptys_open (int fdm, const char * pts_name);
|
||||||
void set_noecho(int fd);
|
void set_noecho(int fd);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,11 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#ifndef _OPENPTY_H
|
#ifndef _OPENPTY_H
|
||||||
#define _OPENPTY_H
|
#define _OPENPTY_H
|
||||||
int ptym_open (char *pts_name);
|
int ptym_open (char *pts_name);
|
||||||
int ptys_open (int fdm, char * pts_name);
|
int ptys_open (int fdm, const char * pts_name);
|
||||||
void set_noecho(int fd);
|
void set_noecho(int fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -23,8 +24,25 @@
|
||||||
#define PATH_MAX 1024
|
#define PATH_MAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PATH_DEF "PATH="
|
||||||
|
const int path_def_len = 5; /* strlen(PATH_DEF); */
|
||||||
|
char * path_val(char * const envp[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (envp == NULL || envp[0] == NULL)
|
||||||
|
return getenv("PATH" );
|
||||||
|
|
||||||
char * pfind(const char *name)
|
for(i = 0; envp[i] != NULL; i++){
|
||||||
|
char* p = envp[i];
|
||||||
|
if(!strncmp(PATH_DEF, p, path_def_len)){
|
||||||
|
return p + path_def_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * pfind(const char *name, char * const envp[])
|
||||||
{
|
{
|
||||||
char *tok;
|
char *tok;
|
||||||
char *sp;
|
char *sp;
|
||||||
|
@ -46,7 +64,7 @@ char * pfind(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search in the PATH environment. */
|
/* Search in the PATH environment. */
|
||||||
path = getenv("PATH" );
|
path = path_val( envp );
|
||||||
|
|
||||||
if (path == NULL || strlen(path) <= 0) {
|
if (path == NULL || strlen(path) <= 0) {
|
||||||
fprintf(stderr, "Unable to get $PATH.\n");
|
fprintf(stderr, "Unable to get $PATH.\n");
|
||||||
|
@ -79,7 +97,7 @@ int main(int argc, char **argv)
|
||||||
char *fullpath;
|
char *fullpath;
|
||||||
|
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
fullpath = pfind(argv[i]);
|
fullpath = pfind(argv[i], NULL);
|
||||||
if (fullpath == NULL)
|
if (fullpath == NULL)
|
||||||
printf("Unable to find %s in $PATH.\n", argv[i]);
|
printf("Unable to find %s in $PATH.\n", argv[i]);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,8 +8,9 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include "PTY.h"
|
#include "PTY.h"
|
||||||
#include "openpty.h"
|
#include "openpty.h"
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
* Signature: ()I
|
* Signature: ()I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboolean console) {
|
||||||
jfieldID fid; /* Store the field ID */
|
jfieldID fid; /* Store the field ID */
|
||||||
jstring jstr = NULL;
|
jstring jstr = NULL;
|
||||||
int master = -1;
|
int master = -1;
|
||||||
|
@ -30,8 +31,10 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
||||||
|
|
||||||
master = ptym_open(line);
|
master = ptym_open(line);
|
||||||
if (master >= 0) {
|
if (master >= 0) {
|
||||||
/* turn off echo */
|
// turn off echo
|
||||||
|
if (console) {
|
||||||
set_noecho(master);
|
set_noecho(master);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get a reference to the obj's class */
|
/* Get a reference to the obj's class */
|
||||||
cls = (*env)->GetObjectClass(env, jobj);
|
cls = (*env)->GetObjectClass(env, jobj);
|
||||||
|
@ -48,3 +51,22 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
||||||
}
|
}
|
||||||
return jstr;
|
return jstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
|
||||||
|
(JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
|
||||||
|
{
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
struct winsize win;
|
||||||
|
|
||||||
|
win.ws_col = width;
|
||||||
|
win.ws_row = height;
|
||||||
|
win.ws_xpixel = 0;
|
||||||
|
win.ws_ypixel = 0;
|
||||||
|
|
||||||
|
return ioctl(fdm, TIOCSWINSZ, &win);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2008 IBM Corporation and others.
|
* Copyright (c) 2003, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software Systems
|
* QNX Software Systems
|
||||||
|
* IBM Corporation - port of 248071
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -90,13 +91,13 @@ static void free_c_array(char **c_array)
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
|
(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
|
||||||
jstring jslaveName, jint masterFD)
|
jstring jslaveName, jint masterFD, jboolean console)
|
||||||
{
|
{
|
||||||
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
|
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
int fd[3];
|
int fd[3];
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
|
||||||
fprintf(stderr, "pts_name: %s\n", pts_name);
|
fprintf(stderr, "pts_name: %s\n", pts_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD);
|
pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
goto bail_out;
|
goto bail_out;
|
||||||
|
|
||||||
|
@ -147,8 +148,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
|
||||||
jstring jdir)
|
jstring jdir)
|
||||||
{
|
{
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
cmd = alloc_c_array(env, jcmd);
|
cmd = alloc_c_array(env, jcmd);
|
||||||
|
@ -194,8 +195,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
|
||||||
{
|
{
|
||||||
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
|
||||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||||
char **cmd;
|
char **cmd = NULL;
|
||||||
char **envp;
|
char **envp = NULL;
|
||||||
int fd[3];
|
int fd[3];
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>5.1.1-SNAPSHOT</version>
|
<version>5.3.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.core.aix</artifactId>
|
<artifactId>org.eclipse.cdt.core.aix</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.scanner;
|
package org.eclipse.cdt.core.parser.tests.scanner;
|
||||||
|
|
||||||
|
@ -202,6 +203,28 @@ public class LexerTests extends BaseTestCase {
|
||||||
eof();
|
eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLessColonColon() throws Exception {
|
||||||
|
// 2.5-3
|
||||||
|
// <: is treated as digraph [
|
||||||
|
init("<::>");
|
||||||
|
token(IToken.tLBRACKET);
|
||||||
|
token(IToken.tRBRACKET);
|
||||||
|
eof();
|
||||||
|
|
||||||
|
// <: is treated as digraph [
|
||||||
|
init("<:::");
|
||||||
|
token(IToken.tLBRACKET);
|
||||||
|
token(IToken.tCOLONCOLON);
|
||||||
|
eof();
|
||||||
|
|
||||||
|
// <:: is treated as < and ::
|
||||||
|
init("<::A");
|
||||||
|
token(IToken.tLT);
|
||||||
|
token(IToken.tCOLONCOLON);
|
||||||
|
token(IToken.tIDENTIFIER);
|
||||||
|
eof();
|
||||||
|
}
|
||||||
|
|
||||||
public void testWindowsLineEnding() throws Exception {
|
public void testWindowsLineEnding() throws Exception {
|
||||||
init("\n\n");
|
init("\n\n");
|
||||||
nl(); nl(); eof();
|
nl(); nl(); eof();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2009, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,9 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
* Chris Recoskie (IBM Corporation)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -133,6 +136,11 @@ public abstract class FileContent {
|
||||||
public static FileContent adapt(CodeReader reader) {
|
public static FileContent adapt(CodeReader reader) {
|
||||||
if (reader == null)
|
if (reader == null)
|
||||||
return null;
|
return null;
|
||||||
return create(reader.getPath(), reader.buffer);
|
|
||||||
|
long fileReadTime = System.currentTimeMillis();
|
||||||
|
CharArray chars = new CharArray(reader.buffer);
|
||||||
|
String filePath = reader.getPath();
|
||||||
|
File file = new File(filePath);
|
||||||
|
return new InternalFileContent(filePath, chars, file.lastModified(), file.length(), fileReadTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Mike Kucera (IBM) - UTF string literals
|
* Mike Kucera (IBM) - UTF string literals
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
Token t= fToken;
|
Token t= fToken;
|
||||||
Token lt= null;
|
Token lt= null;
|
||||||
while (true) {
|
while (true) {
|
||||||
switch(t.getType()) {
|
switch (t.getType()) {
|
||||||
case IToken.tCOMPLETION:
|
case IToken.tCOMPLETION:
|
||||||
if (lt != null) {
|
if (lt != null) {
|
||||||
fLastToken= lt;
|
fLastToken= lt;
|
||||||
|
@ -228,7 +229,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
public Token nextDirective() throws OffsetLimitReachedException {
|
public Token nextDirective() throws OffsetLimitReachedException {
|
||||||
Token t0;
|
Token t0;
|
||||||
Token t1= fToken;
|
Token t1= fToken;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
t0= t1;
|
t0= t1;
|
||||||
t1= fetchToken();
|
t1= fetchToken();
|
||||||
final int tt1 = t1.getType();
|
final int tt1 = t1.getType();
|
||||||
|
@ -252,7 +253,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
final int start= fOffset;
|
final int start= fOffset;
|
||||||
final int c= fCharPhase3;
|
final int c= fCharPhase3;
|
||||||
final int d= nextCharPhase3();
|
final int d= nextCharPhase3();
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case END_OF_INPUT:
|
case END_OF_INPUT:
|
||||||
return newToken(IToken.tEND_OF_INPUT, start);
|
return newToken(IToken.tEND_OF_INPUT, start);
|
||||||
case '\n':
|
case '\n':
|
||||||
|
@ -266,7 +267,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case 'R':
|
case 'R':
|
||||||
if (fOptions.fSupportRawStringLiterals) {
|
if (fOptions.fSupportRawStringLiterals) {
|
||||||
markPhase3();
|
markPhase3();
|
||||||
|
@ -289,7 +290,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'U':
|
case 'U':
|
||||||
if (fOptions.fSupportUTFLiterals) {
|
if (fOptions.fSupportUTFLiterals) {
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case 'R':
|
case 'R':
|
||||||
if (fOptions.fSupportRawStringLiterals) {
|
if (fOptions.fSupportRawStringLiterals) {
|
||||||
markPhase3();
|
markPhase3();
|
||||||
|
@ -364,7 +365,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case 'u': case 'U':
|
case 'u': case 'U':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return identifier(start, 2);
|
return identifier(start, 2);
|
||||||
|
@ -376,7 +377,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
return number(start, 1, false);
|
return number(start, 1, false);
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
|
@ -420,7 +421,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
return newToken(IToken.tSEMI, start);
|
return newToken(IToken.tSEMI, start);
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case ':':
|
case ':':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newToken(IToken.tCOLONCOLON, start);
|
return newToken(IToken.tCOLONCOLON, start);
|
||||||
|
@ -564,7 +565,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
return headerName(start, false);
|
return headerName(start, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case '=':
|
case '=':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newToken(IToken.tLTEQUAL, start);
|
return newToken(IToken.tLTEQUAL, start);
|
||||||
|
@ -582,8 +583,19 @@ final public class Lexer implements ITokenSequence {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ':':
|
case ':':
|
||||||
|
// 2.5-3
|
||||||
|
markPhase3();
|
||||||
|
if (nextCharPhase3() != ':') {
|
||||||
|
return newDigraphToken(IToken.tLBRACKET, start);
|
||||||
|
}
|
||||||
|
switch (nextCharPhase3()) {
|
||||||
|
case ':': case '>':
|
||||||
|
restorePhase3();
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newDigraphToken(IToken.tLBRACKET, start);
|
return newDigraphToken(IToken.tLBRACKET, start);
|
||||||
|
}
|
||||||
|
restorePhase3();
|
||||||
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newDigraphToken(IToken.tLBRACE, start);
|
return newDigraphToken(IToken.tLBRACE, start);
|
||||||
|
@ -591,7 +603,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
return newToken(IToken.tLT, start);
|
return newToken(IToken.tLT, start);
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
switch(d) {
|
switch (d) {
|
||||||
case '=':
|
case '=':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newToken(IToken.tGTEQUAL, start);
|
return newToken(IToken.tGTEQUAL, start);
|
||||||
|
@ -636,7 +648,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
|
|
||||||
private Token newToken(final int kind, final int offset, final int imageLength) {
|
private Token newToken(final int kind, final int offset, final int imageLength) {
|
||||||
final int endOffset= fOffset;
|
final int endOffset= fOffset;
|
||||||
final int sourceLen= endOffset-offset;
|
final int sourceLen= endOffset - offset;
|
||||||
char[] image;
|
char[] image;
|
||||||
if (sourceLen != imageLength) {
|
if (sourceLen != imageLength) {
|
||||||
image= getCharImage(offset, endOffset, imageLength);
|
image= getCharImage(offset, endOffset, imageLength);
|
||||||
|
@ -719,7 +731,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
int c= fCharPhase3;
|
int c= fCharPhase3;
|
||||||
|
|
||||||
loop: while (!done) {
|
loop: while (!done) {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case END_OF_INPUT:
|
case END_OF_INPUT:
|
||||||
if (fSupportContentAssist) {
|
if (fSupportContentAssist) {
|
||||||
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
||||||
|
@ -752,19 +764,19 @@ final public class Lexer implements ITokenSequence {
|
||||||
final int delimOffset= fOffset;
|
final int delimOffset= fOffset;
|
||||||
int delimEndOffset = delimOffset;
|
int delimEndOffset = delimOffset;
|
||||||
int offset;
|
int offset;
|
||||||
for(;; delimEndOffset++) {
|
for (;; delimEndOffset++) {
|
||||||
if (!fInput.isValidOffset(delimEndOffset)) {
|
if (!fInput.isValidOffset(delimEndOffset)) {
|
||||||
offset= delimEndOffset;
|
offset= delimEndOffset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (fInput.get(delimEndOffset) == '(') {
|
if (fInput.get(delimEndOffset) == '(') {
|
||||||
offset= delimEndOffset+1;
|
offset= delimEndOffset + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int delimLength= delimEndOffset-delimOffset;
|
final int delimLength= delimEndOffset - delimOffset;
|
||||||
for(;; offset++) {
|
for (;; offset++) {
|
||||||
if (!fInput.isValidOffset(offset)) {
|
if (!fInput.isValidOffset(offset)) {
|
||||||
handleProblem(IProblem.SCANNER_UNBOUNDED_STRING, getInputChars(start, offset), start);
|
handleProblem(IProblem.SCANNER_UNBOUNDED_STRING, getInputChars(start, offset), start);
|
||||||
break;
|
break;
|
||||||
|
@ -772,27 +784,27 @@ final public class Lexer implements ITokenSequence {
|
||||||
|
|
||||||
final char c= fInput.get(offset);
|
final char c= fInput.get(offset);
|
||||||
if (c == ')') {
|
if (c == ')') {
|
||||||
final int endingDoubleQuoteOffset= offset+delimLength+1;
|
final int endingDoubleQuoteOffset= offset + delimLength + 1;
|
||||||
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
|
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
|
||||||
boolean prefixMatches= true;
|
boolean prefixMatches= true;
|
||||||
for (int i = 0; i < delimLength; i++) {
|
for (int i = 0; i < delimLength; i++) {
|
||||||
if (fInput.get(offset + i + 1) != fInput.get(delimOffset+i)) {
|
if (fInput.get(offset + i + 1) != fInput.get(delimOffset + i)) {
|
||||||
prefixMatches= false;
|
prefixMatches= false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prefixMatches) {
|
if (prefixMatches) {
|
||||||
offset= endingDoubleQuoteOffset+1;
|
offset= endingDoubleQuoteOffset + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fOffset= offset-1;
|
fOffset= offset - 1;
|
||||||
fEndOffset= offset;
|
fEndOffset= offset;
|
||||||
fCharPhase3= 0;
|
fCharPhase3= 0;
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newToken(tokenType, start, offset-start);
|
return newToken(tokenType, start, offset - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Token charLiteral(final int start, final int tokenType) throws OffsetLimitReachedException {
|
private Token charLiteral(final int start, final int tokenType) throws OffsetLimitReachedException {
|
||||||
|
@ -802,7 +814,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
int c= fCharPhase3;
|
int c= fCharPhase3;
|
||||||
|
|
||||||
loop: while (!done) {
|
loop: while (!done) {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case END_OF_INPUT:
|
case END_OF_INPUT:
|
||||||
if (fSupportContentAssist) {
|
if (fSupportContentAssist) {
|
||||||
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
||||||
|
@ -835,7 +847,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
boolean isPartOfIdentifier= true;
|
boolean isPartOfIdentifier= true;
|
||||||
int c= fCharPhase3;
|
int c= fCharPhase3;
|
||||||
while (true) {
|
while (true) {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i':
|
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i':
|
||||||
case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
|
case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
|
||||||
|
@ -849,7 +861,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
|
|
||||||
case '\\': // universal character name
|
case '\\': // universal character name
|
||||||
markPhase3();
|
markPhase3();
|
||||||
switch(nextCharPhase3()) {
|
switch (nextCharPhase3()) {
|
||||||
case 'u': case 'U':
|
case 'u': case 'U':
|
||||||
length++;
|
length++;
|
||||||
break;
|
break;
|
||||||
|
@ -904,7 +916,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
boolean isHex= false;
|
boolean isHex= false;
|
||||||
int c= fCharPhase3;
|
int c= fCharPhase3;
|
||||||
while (true) {
|
while (true) {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
// non-digit
|
// non-digit
|
||||||
case 'a': case 'b': case 'c': case 'd': case 'f': case 'g': case 'h': case 'i':
|
case 'a': case 'b': case 'c': case 'd': case 'f': case 'g': case 'h': case 'i':
|
||||||
case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'q': case 'r':
|
case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'q': case 'r':
|
||||||
|
@ -952,7 +964,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
// universal character name (non-digit)
|
// universal character name (non-digit)
|
||||||
case '\\':
|
case '\\':
|
||||||
markPhase3();
|
markPhase3();
|
||||||
switch(nextCharPhase3()) {
|
switch (nextCharPhase3()) {
|
||||||
case 'u': case 'U':
|
case 'u': case 'U':
|
||||||
length++;
|
length++;
|
||||||
break;
|
break;
|
||||||
|
@ -1013,7 +1025,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
private int nextCharPhase3() {
|
private int nextCharPhase3() {
|
||||||
int pos= fEndOffset;
|
int pos= fEndOffset;
|
||||||
do {
|
do {
|
||||||
if (!isValidOffset(pos+1)) {
|
if (!isValidOffset(pos + 1)) {
|
||||||
if (!isValidOffset(pos)) {
|
if (!isValidOffset(pos)) {
|
||||||
fOffset= pos;
|
fOffset= pos;
|
||||||
fEndOffset= pos;
|
fEndOffset= pos;
|
||||||
|
@ -1021,7 +1033,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
return END_OF_INPUT;
|
return END_OF_INPUT;
|
||||||
}
|
}
|
||||||
fOffset= pos;
|
fOffset= pos;
|
||||||
fEndOffset= pos+1;
|
fEndOffset= pos + 1;
|
||||||
fCharPhase3= fInput.get(pos);
|
fCharPhase3= fInput.get(pos);
|
||||||
return fCharPhase3;
|
return fCharPhase3;
|
||||||
}
|
}
|
||||||
|
@ -1030,7 +1042,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
fOffset= pos;
|
fOffset= pos;
|
||||||
fEndOffset= ++pos;
|
fEndOffset= ++pos;
|
||||||
fCharPhase3= c;
|
fCharPhase3= c;
|
||||||
switch(c) {
|
switch (c) {
|
||||||
// windows line-ending
|
// windows line-ending
|
||||||
case '\r':
|
case '\r':
|
||||||
if (fInput.get(pos) == '\n') {
|
if (fInput.get(pos) == '\n') {
|
||||||
|
@ -1080,7 +1092,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
* @return the character encoded or 0.
|
* @return the character encoded or 0.
|
||||||
*/
|
*/
|
||||||
private char checkTrigraph(char c) {
|
private char checkTrigraph(char c) {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case '=': return '#';
|
case '=': return '#';
|
||||||
case '\'':return '^';
|
case '\'':return '^';
|
||||||
case '(': return '[';
|
case '(': return '[';
|
||||||
|
@ -1101,7 +1113,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
boolean haveBackslash= true;
|
boolean haveBackslash= true;
|
||||||
int result= -1;
|
int result= -1;
|
||||||
loop: while (isValidOffset(pos)) {
|
loop: while (isValidOffset(pos)) {
|
||||||
switch(fInput.get(pos++)) {
|
switch (fInput.get(pos++)) {
|
||||||
case '\n':
|
case '\n':
|
||||||
if (haveBackslash) {
|
if (haveBackslash) {
|
||||||
result= pos;
|
result= pos;
|
||||||
|
@ -1140,7 +1152,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
* Returns the image from the input without any modification.
|
* Returns the image from the input without any modification.
|
||||||
*/
|
*/
|
||||||
public char[] getInputChars(int offset, int endOffset) {
|
public char[] getInputChars(int offset, int endOffset) {
|
||||||
final int length= endOffset-offset;
|
final int length= endOffset - offset;
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
return CharArrayUtils.EMPTY;
|
return CharArrayUtils.EMPTY;
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1172,7 @@ final public class Lexer implements ITokenSequence {
|
||||||
final char[] result= new char[imageLength];
|
final char[] result= new char[imageLength];
|
||||||
markPhase3();
|
markPhase3();
|
||||||
fEndOffset= offset;
|
fEndOffset= offset;
|
||||||
for (int idx=0; idx<imageLength; idx++) {
|
for (int idx= 0; idx < imageLength; idx++) {
|
||||||
result[idx]= (char) nextCharPhase3();
|
result[idx]= (char) nextCharPhase3();
|
||||||
}
|
}
|
||||||
restorePhase3();
|
restorePhase3();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
* Copyright (c) 2005, 2013 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
* Tim Kelly (Nokia)
|
* Tim Kelly (Nokia)
|
||||||
* Anna Dushistova (MontaVista)
|
* Anna Dushistova (MontaVista)
|
||||||
* Marc-Andre Laperle
|
* Marc-Andre Laperle
|
||||||
|
* Martin Oberhuber (Wind River) - [397652] fix up-to-date check for PDOM
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -93,6 +95,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.ISafeRunnable;
|
import org.eclipse.core.runtime.ISafeRunnable;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -109,6 +112,7 @@ import org.eclipse.core.runtime.preferences.IPreferencesService;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
import com.ibm.icu.text.SimpleDateFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages PDOM updates and events associated with them. Provides methods for index access.
|
* Manages PDOM updates and events associated with them. Provides methods for index access.
|
||||||
|
@ -1529,11 +1533,25 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public boolean isProjectContentSynced(ICProject cproject) throws CoreException {
|
public boolean isProjectContentSynced(ICProject cproject) throws CoreException {
|
||||||
|
IStatus s = getProjectContentSyncState(cproject);
|
||||||
|
return s == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the index is in sync with the file system.
|
||||||
|
* @param cproject the project to check
|
||||||
|
* @return <code>null</code> when the content in the project fragment of the specified project's index
|
||||||
|
* is complete (contains all sources) and up to date; or an @link{IStatus} indicating the first
|
||||||
|
* occurrence of an index file found not up-to-date, along with its include trail.
|
||||||
|
* @throws CoreException in case of a file access or other internal error
|
||||||
|
*/
|
||||||
|
public IStatus getProjectContentSyncState(ICProject cproject) throws CoreException {
|
||||||
if (!"true".equals(IndexerPreferences.get(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, null))) //$NON-NLS-1$
|
if (!"true".equals(IndexerPreferences.get(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, null))) //$NON-NLS-1$
|
||||||
return true; // no check performed in this case
|
return null; // No check is performed in this case
|
||||||
|
|
||||||
Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>();
|
Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>();
|
||||||
cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor()));
|
cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor()));
|
||||||
|
IStatus syncStatus = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IIndex index= getIndex(cproject);
|
IIndex index= getIndex(cproject);
|
||||||
|
@ -1543,8 +1561,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
IResource resource= tu.getResource();
|
IResource resource= tu.getResource();
|
||||||
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
|
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
|
||||||
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile) resource);
|
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile) resource);
|
||||||
if (!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
|
syncStatus = areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location);
|
||||||
return false;
|
if (syncStatus != null) {
|
||||||
|
return syncStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1555,11 +1574,11 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSubjectToIndexing(ILanguage language) {
|
private boolean isSubjectToIndexing(ILanguage language) {
|
||||||
final int linkageID=language.getLinkageID();
|
final int linkageID = language.getLinkageID();
|
||||||
for (int id : IDS_FOR_LINKAGES_TO_INDEX) {
|
for (int id : IDS_FOR_LINKAGES_TO_INDEX) {
|
||||||
if (linkageID == id)
|
if (linkageID == id)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1568,45 +1587,57 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively checks that the specified file, and its include are up-to-date.
|
* Recursively checks that the specified file, and its includes are up-to-date.
|
||||||
* @param trail a set of previously checked include file locations
|
* @param trail a set of previously checked include file locations
|
||||||
* @param index the index to check against
|
* @param index the index to check against
|
||||||
* @param resource the resource to check from the workspace
|
* @param resource the resource to check from the workspace
|
||||||
* @param location the location to check from the index
|
* @param location the location to check from the index
|
||||||
* @return whether the specified file, and its includes are up-to-date.
|
* @return <code>null</code> when whether the specified file, and its includes are up-to-date,
|
||||||
|
* or a MultiStatus indicating the file found to be not in sync along with it include trail.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
|
private static MultiStatus areSynchronized(Set<IIndexFileLocation> trail, IIndex index,
|
||||||
|
IResource resource, IIndexFileLocation location) throws CoreException {
|
||||||
if (!trail.contains(location)) {
|
if (!trail.contains(location)) {
|
||||||
trail.add(location);
|
trail.add(location);
|
||||||
|
|
||||||
IIndexFile[] file= index.getFiles(location);
|
IIndexFile[] files= index.getFiles(location);
|
||||||
|
|
||||||
// pre-includes may be listed twice (191989)
|
if (files.length <= 0)
|
||||||
if (file.length < 1 || file.length > 2)
|
return new MultiStatus(CCorePlugin.PLUGIN_ID, IStatus.OK, "No index file found for: " + location, null); //$NON-NLS-1$
|
||||||
return false;
|
|
||||||
|
|
||||||
if (resource.getLocalTimeStamp() != file[0].getTimestamp())
|
for (IIndexFile file : files) {
|
||||||
return false;
|
long diff = resource.getLocalTimeStamp() - file.getTimestamp();
|
||||||
|
if (diff != 0) {
|
||||||
|
return new MultiStatus(CCorePlugin.PLUGIN_ID, IStatus.OK,
|
||||||
|
"Index timestamp for '" //$NON-NLS-1$
|
||||||
|
+ file.getLocation().getFullPath()
|
||||||
|
+ "' is " + diff + " msec older than " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ location
|
||||||
|
+ "(" + SimpleDateFormat.getDateTimeInstance().format(new Date(resource.getLocalTimeStamp())) //$NON-NLS-1$
|
||||||
|
+ ")", null); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
// if it is up-to-date, the includes have not changed and may
|
// If it is up-to-date, the includes have not changed and may be read from the index.
|
||||||
// be read from the index.
|
IIndexInclude[] includes= index.findIncludes(file);
|
||||||
IIndexInclude[] includes= index.findIncludes(file[0]);
|
|
||||||
for (IIndexInclude inc : includes) {
|
for (IIndexInclude inc : includes) {
|
||||||
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
||||||
if (newLocation != null) {
|
if (newLocation != null) {
|
||||||
String path= newLocation.getFullPath();
|
String path= newLocation.getFullPath();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
||||||
if (!areSynchronized(trail, index, newResource, newLocation)) {
|
MultiStatus m = areSynchronized(trail, index, newResource, newLocation);
|
||||||
return false;
|
if (m != null) {
|
||||||
|
m.add(new Status(IStatus.INFO, CCorePlugin.PLUGIN_ID,
|
||||||
|
"Included by " + file.getLocation().getFullPath())); //$NON-NLS-1$
|
||||||
|
return m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFileIndexedUnconditionally(IIndexFileLocation ifl) {
|
public boolean isFileIndexedUnconditionally(IIndexFileLocation ifl) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2013 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,11 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial implementation
|
* Andrew Ferguson (Symbian) - Initial implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Martin Oberhuber (Wind River) - [397652] fix up-to-date check for PDOM
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.export;
|
package org.eclipse.cdt.internal.core.pdom.export;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -26,9 +26,12 @@ import org.eclipse.cdt.internal.core.pdom.WritablePDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ISafeRunnable which
|
* An ISafeRunnable which
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -43,12 +46,26 @@ public class GeneratePDOM {
|
||||||
protected File targetLocation;
|
protected File targetLocation;
|
||||||
protected String indexerID;
|
protected String indexerID;
|
||||||
protected boolean deleteOnExit;
|
protected boolean deleteOnExit;
|
||||||
|
protected boolean checkIndexStatus;
|
||||||
|
|
||||||
public GeneratePDOM(IExportProjectProvider pm, String[] applicationArguments, File targetLocation, String indexerID) {
|
/**
|
||||||
|
* Runnable to export a PDOM.
|
||||||
|
* @param checkIndexStatus <code>true</code> to check index completeness before exporting, or
|
||||||
|
* <code>false</code> to export the index without checking anything
|
||||||
|
* @since 5.5
|
||||||
|
*/
|
||||||
|
public GeneratePDOM(IExportProjectProvider pm, String[] applicationArguments, File targetLocation,
|
||||||
|
String indexerID, boolean checkIndexStatus) {
|
||||||
this.pm= pm;
|
this.pm= pm;
|
||||||
this.applicationArguments= applicationArguments;
|
this.applicationArguments= applicationArguments;
|
||||||
this.targetLocation= targetLocation;
|
this.targetLocation= targetLocation;
|
||||||
this.indexerID= indexerID;
|
this.indexerID= indexerID;
|
||||||
|
this.checkIndexStatus= checkIndexStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneratePDOM(IExportProjectProvider pm, String[] applicationArguments, File targetLocation,
|
||||||
|
String indexerID) {
|
||||||
|
this(pm, applicationArguments, targetLocation, indexerID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,74 +83,77 @@ public class GeneratePDOM {
|
||||||
* @throws CoreException if an internal or invalid configuration error occurs
|
* @throws CoreException if an internal or invalid configuration error occurs
|
||||||
*/
|
*/
|
||||||
public final IStatus run() throws CoreException {
|
public final IStatus run() throws CoreException {
|
||||||
boolean isContentSynced= false;
|
// Create the project
|
||||||
|
|
||||||
// create the project
|
|
||||||
pm.setApplicationArguments(applicationArguments);
|
pm.setApplicationArguments(applicationArguments);
|
||||||
final ICProject cproject = pm.createProject();
|
final ICProject cproject = pm.createProject();
|
||||||
if(cproject==null) {
|
if (cproject == null) {
|
||||||
fail(MessageFormat.format(Messages.GeneratePDOM_ProjectProviderReturnedNullCProject,
|
fail(MessageFormat.format(Messages.GeneratePDOM_ProjectProviderReturnedNullCProject,
|
||||||
new Object [] {pm.getClass().getName()}));
|
new Object[] { pm.getClass().getName() }));
|
||||||
return null; // cannot be reached, inform the compiler
|
return null; // Cannot be reached, inform the compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
||||||
if(converter==null) {
|
if (converter == null) {
|
||||||
fail(MessageFormat.format(Messages.GeneratePDOM_NullLocationConverter,
|
fail(MessageFormat.format(Messages.GeneratePDOM_NullLocationConverter,
|
||||||
new Object [] {pm.getClass().getName()}));
|
new Object[] { pm.getClass().getName() }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// index the project
|
// Index the project
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final IIndexManager im = CCorePlugin.getIndexManager();
|
final IIndexManager manager = CCorePlugin.getIndexManager();
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
if(CCoreInternals.getPDOMManager().isProjectRegistered(cproject)) {
|
if (CCoreInternals.getPDOMManager().isProjectRegistered(cproject)) {
|
||||||
im.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
manager.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
||||||
if (!im.isIndexerSetupPostponed(cproject)) {
|
if (!manager.isIndexerSetupPostponed(cproject)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check status
|
if (checkIndexStatus) {
|
||||||
isContentSynced= CCoreInternals.getPDOMManager().isProjectContentSynced(cproject);
|
// Check status
|
||||||
|
IStatus syncStatus = CCoreInternals.getPDOMManager().getProjectContentSyncState(cproject);
|
||||||
if(isContentSynced) {
|
if (syncStatus != null) {
|
||||||
// export a .pdom file
|
// Add message and error severity
|
||||||
|
IStatus myStatus = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Incomplete);
|
||||||
|
MultiStatus m = new MultiStatus(CCorePlugin.PLUGIN_ID, 1, new IStatus[] {myStatus, syncStatus},
|
||||||
|
Messages.GeneratePDOM_Incomplete, null);
|
||||||
|
// Log the status right away since legacy clients did not return any status details
|
||||||
|
CCorePlugin.log(m);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Export a .pdom file
|
||||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
||||||
|
|
||||||
// write properties to exported PDOM
|
// Write properties to exported PDOM
|
||||||
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter,
|
||||||
|
LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
exportedPDOM.acquireWriteLock(0);
|
exportedPDOM.acquireWriteLock(0);
|
||||||
try {
|
try {
|
||||||
Map<String,String> exportProperties= pm.getExportProperties();
|
Map<String, String> exportProperties= pm.getExportProperties();
|
||||||
if(exportProperties!=null) {
|
if (exportProperties != null) {
|
||||||
for(Map.Entry<String,String> entry : exportProperties.entrySet()) {
|
for(Map.Entry<String, String> entry : exportProperties.entrySet()) {
|
||||||
exportedPDOM.setProperty(entry.getKey(), entry.getValue());
|
exportedPDOM.setProperty(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exportedPDOM.close();
|
exportedPDOM.close();
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
exportedPDOM.releaseWriteLock();
|
exportedPDOM.releaseWriteLock();
|
||||||
}
|
}
|
||||||
}
|
} catch (InterruptedException ie) {
|
||||||
|
|
||||||
} catch(InterruptedException ie) {
|
|
||||||
String msg= MessageFormat.format(Messages.GeneratePDOM_GenericGenerationFailed, new Object[] {ie.getMessage()});
|
String msg= MessageFormat.format(Messages.GeneratePDOM_GenericGenerationFailed, new Object[] {ie.getMessage()});
|
||||||
throw new CoreException(CCorePlugin.createStatus(msg, ie));
|
throw new CoreException(CCorePlugin.createStatus(msg, ie));
|
||||||
} finally {
|
} finally {
|
||||||
if(deleteOnExit) {
|
if (deleteOnExit) {
|
||||||
cproject.getProject().delete(true, new NullProgressMonitor());
|
cproject.getProject().delete(true, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isContentSynced ?
|
return new Status(IStatus.OK, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Success);
|
||||||
new Status(IStatus.OK, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Success)
|
|
||||||
: new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Incomplete);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fail(String message) throws CoreException {
|
private void fail(String message) throws CoreException {
|
||||||
|
|
|
@ -771,6 +771,16 @@
|
||||||
</baseType>
|
</baseType>
|
||||||
</complexArray>
|
</complexArray>
|
||||||
</processType>
|
</processType>
|
||||||
|
<processType
|
||||||
|
name="AddNature"
|
||||||
|
processRunner="org.eclipse.cdt.core.templateengine.process.processes.AddNature">
|
||||||
|
<simple
|
||||||
|
name="projectName">
|
||||||
|
</simple>
|
||||||
|
<simple
|
||||||
|
name="natureId">
|
||||||
|
</simple>
|
||||||
|
</processType>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.core.CProjectDescriptionStorage">
|
point="org.eclipse.cdt.core.CProjectDescriptionStorage">
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Doug Schaefer (QNX) - Initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.templateengine.process.processes;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
|
import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
|
||||||
|
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
|
||||||
|
import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author dschaefer
|
||||||
|
* @since 5.5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddNature extends ProcessRunner {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
|
||||||
|
IProject project = null;
|
||||||
|
String natureId = null;
|
||||||
|
|
||||||
|
for (ProcessArgument arg : args) {
|
||||||
|
String argName = arg.getName();
|
||||||
|
if (argName.equals("projectName")) //$NON-NLS-1$
|
||||||
|
project = ResourcesPlugin.getWorkspace().getRoot().getProject(arg.getSimpleValue());
|
||||||
|
else if (argName.equals("natureId")) //$NON-NLS-1$
|
||||||
|
natureId = arg.getSimpleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project == null)
|
||||||
|
throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noProject"))); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (natureId == null)
|
||||||
|
throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noNature"))); //$NON-NLS-1$
|
||||||
|
|
||||||
|
try {
|
||||||
|
CProjectNature.addNature(project, natureId, monitor);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
throw new ProcessFailureException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -55,3 +55,5 @@ Append.0=Add File failure: template source not found:
|
||||||
Append.1=Copy failure: template source not found:
|
Append.1=Copy failure: template source not found:
|
||||||
Append.3=Copy failure: cannot read template source:
|
Append.3=Copy failure: cannot read template source:
|
||||||
Append.4=Append failure: failed while trying to append contents.
|
Append.4=Append failure: failed while trying to append contents.
|
||||||
|
AddNature.noProject=Add nature failure: projectName not specified
|
||||||
|
AddNature.noNature=Add nature failure: nature not specified
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class CIndenterTest extends BaseUITestCase {
|
||||||
//class MyClass {
|
//class MyClass {
|
||||||
//typedef int MyType;
|
//typedef int MyType;
|
||||||
//public:
|
//public:
|
||||||
//int getA() {
|
//virtual int getA() {
|
||||||
//return a;
|
//return a;
|
||||||
//}
|
//}
|
||||||
//MyClass();
|
//MyClass();
|
||||||
|
@ -444,7 +444,7 @@ public class CIndenterTest extends BaseUITestCase {
|
||||||
//class MyClass {
|
//class MyClass {
|
||||||
// typedef int MyType;
|
// typedef int MyType;
|
||||||
// public:
|
// public:
|
||||||
// int getA() {
|
// virtual int getA() {
|
||||||
// return a;
|
// return a;
|
||||||
// }
|
// }
|
||||||
// MyClass();
|
// MyClass();
|
||||||
|
|
|
@ -28,26 +28,21 @@ import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests to verify the C partitioning.
|
* Tests to verify the C partitioning.
|
||||||
* Derived from JavaPartitionerTest.
|
* Derived from JavaPartitionerTest.
|
||||||
*/
|
*/
|
||||||
public class CPartitionerTest extends TestCase {
|
public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
private CTextTools fTextTools;
|
private CTextTools fTextTools;
|
||||||
private Document fDocument;
|
private Document fDocument;
|
||||||
protected boolean fDocumentPartitioningChanged;
|
protected boolean fDocumentPartitioningChanged;
|
||||||
|
|
||||||
|
|
||||||
public CPartitionerTest(String name) {
|
public CPartitionerTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
|
|
||||||
fTextTools= new CTextTools();
|
fTextTools= new CTextTools();
|
||||||
|
|
||||||
fDocument= new Document();
|
fDocument= new Document();
|
||||||
|
@ -84,7 +79,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
|
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
|
||||||
|
|
||||||
assertEquals("invalid number of partitions", expectation.length, result.length);
|
assertEquals("invalid number of partitions", expectation.length, result.length);
|
||||||
|
|
||||||
for (int i= 0; i < expectation.length; i++) {
|
for (int i= 0; i < expectation.length; i++) {
|
||||||
|
@ -92,12 +86,10 @@ public class CPartitionerTest extends TestCase {
|
||||||
ITypedRegion r= result[i];
|
ITypedRegion r= result[i];
|
||||||
assertTrue(print(r) + " != " + print(e), r.equals(e));
|
assertTrue(print(r) + " != " + print(e), r.equals(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInitialPartitioning() {
|
public void testInitialPartitioning() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -121,7 +113,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testIntraPartitionChange() {
|
public void testIntraPartitionChange() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(34, 3, "y");
|
fDocument.replace(34, 3, "y");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -148,7 +139,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testIntraPartitionChange2() {
|
public void testIntraPartitionChange2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(41, 0, "yyy");
|
fDocument.replace(41, 0, "yyy");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
|
||||||
|
|
||||||
|
@ -172,9 +162,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertNewPartition() {
|
public void testInsertNewPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "/***/");
|
fDocument.replace(35, 1, "/***/");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -200,9 +190,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertStringPartition() {
|
public void testInsertStringPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "\"yyy\"");
|
fDocument.replace(35, 1, "\"yyy\"");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -228,9 +218,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertCharacterPartition() {
|
public void testInsertCharacterPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(35, 1, "'y'");
|
fDocument.replace(35, 1, "'y'");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
|
||||||
|
@ -256,9 +246,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInsertPreprocessorPartition() {
|
public void testInsertPreprocessorPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(4, 0, " # include <x.h>\n");
|
fDocument.replace(4, 0, " # include <x.h>\n");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
// "xxx\n # include <x.h>\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
// "xxx\n # include <x.h>\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||||
|
@ -287,13 +277,11 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRemovePartition1() {
|
public void testRemovePartition1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(13, 16, null);
|
fDocument.replace(13, 16, null);
|
||||||
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
|
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
|
@ -312,12 +300,10 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemovePartition2() {
|
public void testRemovePartition2() {
|
||||||
|
|
||||||
testJoinPartition3();
|
testJoinPartition3();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(5, 2, null);
|
fDocument.replace(5, 2, null);
|
||||||
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -340,10 +326,8 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testJoinPartitions1() {
|
public void testJoinPartitions1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(31, 1, null);
|
fDocument.replace(31, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -368,7 +352,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testJoinPartitions2() {
|
public void testJoinPartitions2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(32, 1, null);
|
fDocument.replace(32, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -393,7 +376,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testJoinPartition3() {
|
public void testJoinPartition3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(9, 2, null);
|
fDocument.replace(9, 2, null);
|
||||||
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
|
@ -416,22 +398,16 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testSplitPartition1() {
|
public void testSplitPartition1() {
|
||||||
|
|
||||||
testJoinPartitions1();
|
testJoinPartitions1();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(31, 0, "*");
|
fDocument.replace(31, 0, "*");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -440,18 +416,15 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSplitPartition2() {
|
public void testSplitPartition2() {
|
||||||
|
|
||||||
testJoinPartitions2();
|
testJoinPartitions2();
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(32, 0, "/");
|
fDocument.replace(32, 0, "/");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
|
||||||
assertTrue(fDocumentPartitioningChanged);
|
assertTrue(fDocumentPartitioningChanged);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -460,11 +433,9 @@ public class CPartitionerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSplitPartition3() {
|
public void testSplitPartition3() {
|
||||||
|
|
||||||
fDocumentPartitioningChanged= false;
|
fDocumentPartitioningChanged= false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
fDocument.replace(12, 9, "");
|
fDocument.replace(12, 9, "");
|
||||||
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||||
|
@ -490,7 +461,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning1() {
|
public void testCorruptPartitioning1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -513,7 +483,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(14, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(14, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +490,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning2() {
|
public void testCorruptPartitioning2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -548,7 +516,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(22, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(22, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +523,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCorruptPartitioning3() {
|
public void testCorruptPartitioning3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
|
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -581,7 +547,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(17, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(17, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
new TypedRegion(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -589,7 +554,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testOpenPartition1() {
|
public void testOpenPartition1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(42, 1, null);
|
fDocument.replace(42, 1, null);
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
|
||||||
|
|
||||||
|
@ -616,7 +580,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testOpenPartition2() {
|
public void testOpenPartition2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(47, 0, "/*");
|
fDocument.replace(47, 0, "/*");
|
||||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
|
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
|
||||||
|
|
||||||
|
@ -646,7 +609,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testPartitionFinder() {
|
public void testPartitionFinder() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
|
||||||
for (int i= 0; i < partitioning.length; i++) {
|
for (int i= 0; i < partitioning.length; i++) {
|
||||||
|
@ -656,7 +618,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
assertTrue(expected.equals(result));
|
assertTrue(expected.equals(result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -664,7 +625,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testExtendPartition() {
|
public void testExtendPartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/*");
|
fDocument.replace(0, fDocument.getLength(), "/*");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -681,7 +641,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -689,7 +648,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testTogglePartition() {
|
public void testTogglePartition() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
|
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -712,7 +670,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(10, 12, ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(10, 12, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation2, result);
|
checkPartitioning(expectation2, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -720,7 +677,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing1() {
|
public void testEditing1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -749,7 +705,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -757,7 +712,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing2() {
|
public void testEditing2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -794,7 +748,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_MULTI_LINE_COMMENT)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_MULTI_LINE_COMMENT)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -802,7 +755,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditing3() {
|
public void testEditing3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -831,7 +783,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(8, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(8, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -839,7 +790,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingString() {
|
public void testEditingString() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -904,7 +854,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(5, 2, ICPartitions.C_STRING)
|
new TypedRegion(5, 2, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -912,7 +861,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingCharacter() {
|
public void testEditingCharacter() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -977,7 +925,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(5, 2, ICPartitions.C_CHARACTER)
|
new TypedRegion(5, 2, ICPartitions.C_CHARACTER)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -985,7 +932,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingPreprocessor() {
|
public void testEditingPreprocessor() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "");
|
fDocument.replace(0, fDocument.getLength(), "");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1096,7 +1042,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(33, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(33, 1, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1049,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testLineSplicing_Bug124113() {
|
public void testLineSplicing_Bug124113() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
|
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1136,7 +1080,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1144,7 +1087,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testCommentInPreprocessorString() {
|
public void testCommentInPreprocessorString() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
|
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
|
||||||
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
|
@ -1160,7 +1102,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
|
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1109,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testString1() {
|
public void testString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
|
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1184,7 +1124,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(10, 9, ICPartitions.C_STRING)
|
new TypedRegion(10, 9, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1192,7 +1131,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testString2() {
|
public void testString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
|
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1202,7 +1140,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
|
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1147,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString1() {
|
public void testRawString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
|
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1235,7 +1171,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
|
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1178,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString2() {
|
public void testRawString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1261,7 +1195,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
|
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1202,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString3() {
|
public void testRawString3() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1291,7 +1223,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1230,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testRawString_Bug352544() {
|
public void testRawString_Bug352544() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1308,7 +1238,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1316,7 +1245,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString1() {
|
public void testEditingRawString1() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1351,7 +1279,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1359,7 +1286,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString2() {
|
public void testEditingRawString2() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
|
@ -1402,7 +1328,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
|
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -1410,8 +1335,7 @@ public class CPartitionerTest extends TestCase {
|
||||||
|
|
||||||
public void testEditingRawString3() {
|
public void testEditingRawString3() {
|
||||||
try {
|
try {
|
||||||
|
fDocument.replace(0, fDocument.getLength(), "/***/R\"\"(line 1\nline 2\nline 3\n)\"\" \"str\"");
|
||||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
|
||||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||||
TypedRegion[] expectation= {
|
TypedRegion[] expectation= {
|
||||||
new TypedRegion(0, 5, ICPartitions.C_MULTI_LINE_COMMENT),
|
new TypedRegion(0, 5, ICPartitions.C_MULTI_LINE_COMMENT),
|
||||||
|
@ -1433,7 +1357,6 @@ public class CPartitionerTest extends TestCase {
|
||||||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||||
};
|
};
|
||||||
checkPartitioning(expectation, result);
|
checkPartitioning(expectation, result);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,6 +606,8 @@ excludedFile.name = C/C++ Files and Folders Excluded from Build
|
||||||
excludedFile.description = Decorates source files and folders excluded from C/C++ build.
|
excludedFile.description = Decorates source files and folders excluded from C/C++ build.
|
||||||
includeFolderDecorator.name = C/C++ Missing Include Folders
|
includeFolderDecorator.name = C/C++ Missing Include Folders
|
||||||
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
||||||
|
CustomBuildSettingsDecorator.name= C/C++ Files and Folders with Customized Build Settings
|
||||||
|
CustomBuildSettingsDecorator.description= Decorates files and folders when build settings are different from parent resource.
|
||||||
|
|
||||||
templatesViewName= Templates
|
templatesViewName= Templates
|
||||||
|
|
||||||
|
|
|
@ -4156,6 +4156,22 @@
|
||||||
</or>
|
</or>
|
||||||
</enablement>
|
</enablement>
|
||||||
</decorator>
|
</decorator>
|
||||||
|
<decorator
|
||||||
|
adaptable="true"
|
||||||
|
class="org.eclipse.cdt.internal.ui.viewsupport.CustomBuildSettingsDecorator"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CustomBuildSettingsDecorator"
|
||||||
|
label="%CustomBuildSettingsDecorator.name"
|
||||||
|
lightweight="true"
|
||||||
|
location="TOP_RIGHT"
|
||||||
|
state="true">
|
||||||
|
<description>%CustomBuildSettingsDecorator.description</description>
|
||||||
|
<enablement>
|
||||||
|
<or>
|
||||||
|
<objectClass name="org.eclipse.core.resources.IFile" />
|
||||||
|
<objectClass name="org.eclipse.core.resources.IFolder" />
|
||||||
|
</or>
|
||||||
|
</enablement>
|
||||||
|
</decorator>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<!-- Hyperlinking support -->
|
<!-- Hyperlinking support -->
|
||||||
|
|
|
@ -93,13 +93,12 @@ import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider;
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractCModelOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener, IAdaptable {
|
public abstract class AbstractCModelOutlinePage extends Page
|
||||||
|
implements IContentOutlinePage, ISelectionChangedListener, IAdaptable {
|
||||||
/**
|
/**
|
||||||
* The default label provider for the outline.
|
* The default label provider for the outline.
|
||||||
*/
|
*/
|
||||||
public static class COutlineLabelProvider extends AppearanceAwareLabelProvider {
|
public static class COutlineLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag whether to show member definitions with qualified or simple names.
|
* Flag whether to show member definitions with qualified or simple names.
|
||||||
*/
|
*/
|
||||||
|
@ -148,9 +147,7 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
public OutlineTreeViewer(Composite parent, int flags) {
|
public OutlineTreeViewer(Composite parent, int flags) {
|
||||||
super(parent, flags);
|
super(parent, flags);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @see TreeViewer#internalExpandToLevel
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalExpandToLevel(Widget node, int level) {
|
protected void internalExpandToLevel(Widget node, int level) {
|
||||||
if (node instanceof Item) {
|
if (node instanceof Item) {
|
||||||
|
@ -213,7 +210,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
public boolean isIncludesGroupingEnabled () {
|
public boolean isIncludesGroupingEnabled () {
|
||||||
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES);
|
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +243,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
public boolean isMacroGroupingEnabled () {
|
public boolean isMacroGroupingEnabled () {
|
||||||
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS);
|
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,7 +252,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
|
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new action.
|
* Constructs a new action.
|
||||||
*/
|
*/
|
||||||
|
@ -277,7 +271,9 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long TEXT_FLAGS = AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | CElementLabels.F_APP_TYPE_SIGNATURE | CElementLabels.M_APP_RETURNTYPE;
|
private static final long TEXT_FLAGS =
|
||||||
|
AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | CElementLabels.F_APP_TYPE_SIGNATURE |
|
||||||
|
CElementLabels.M_APP_RETURNTYPE;
|
||||||
private static final int IMAGE_FLAGS = AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS;
|
private static final int IMAGE_FLAGS = AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS;
|
||||||
protected ITextEditor fEditor;
|
protected ITextEditor fEditor;
|
||||||
protected ITranslationUnit fInput;
|
protected ITranslationUnit fInput;
|
||||||
|
@ -374,7 +370,7 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
int offset= tsel.getOffset();
|
int offset= tsel.getOffset();
|
||||||
ICElement element= null;
|
ICElement element= null;
|
||||||
if (fEditor instanceof CEditor) {
|
if (fEditor instanceof CEditor) {
|
||||||
element= ((CEditor)fEditor).getElementAt(offset, false);
|
element= ((CEditor) fEditor).getElementAt(offset, false);
|
||||||
} else if (fInput != null) {
|
} else if (fInput != null) {
|
||||||
try {
|
try {
|
||||||
element= fInput.getElementAtOffset(offset);
|
element= fInput.getElementAtOffset(offset);
|
||||||
|
@ -407,11 +403,11 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
* Sets the selected element to the one at the current cursor position in the editor.
|
* Sets the selected element to the one at the current cursor position in the editor.
|
||||||
*/
|
*/
|
||||||
public void synchronizeSelectionWithEditor() {
|
public void synchronizeSelectionWithEditor() {
|
||||||
if(fInput == null || fEditor == null || fTreeViewer == null)
|
if (fInput == null || fEditor == null || fTreeViewer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ITextSelection editorSelection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
|
ITextSelection editorSelection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
|
||||||
if(editorSelection == null)
|
if (editorSelection == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int offset = editorSelection.getOffset();
|
int offset = editorSelection.getOffset();
|
||||||
|
@ -513,7 +509,8 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
site.setSelectionProvider(fTreeViewer);
|
site.setSelectionProvider(fTreeViewer);
|
||||||
|
|
||||||
IActionBars bars= site.getActionBars();
|
IActionBars bars= site.getActionBars();
|
||||||
bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation);
|
bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY,
|
||||||
|
fTogglePresentation);
|
||||||
|
|
||||||
fSelectionSearchGroup = createSearchActionGroup();
|
fSelectionSearchGroup = createSearchActionGroup();
|
||||||
fOpenViewActionGroup = createOpenViewActionGroup();
|
fOpenViewActionGroup = createOpenViewActionGroup();
|
||||||
|
@ -786,5 +783,4 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
||||||
};
|
};
|
||||||
fTreeViewer.addDragSupport(ops, transfers, new CDTViewerDragAdapter(fTreeViewer, dragListeners));
|
fTreeViewer.addDragSupport(ops, transfers, new CDTViewerDragAdapter(fTreeViewer, dragListeners));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2012 IBM Corporation and others.
|
* Copyright (c) 2005, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -1637,7 +1637,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fOutlinePage = new CContentOutlinePage(this);
|
fOutlinePage = new CContentOutlinePage(this);
|
||||||
fOutlinePage.addSelectionChangedListener(this);
|
fOutlinePage.addSelectionChangedListener(this);
|
||||||
}
|
}
|
||||||
setOutlinePageInput(fOutlinePage, getEditorInput());
|
setOutlinePageInputIfNotSame(fOutlinePage, getEditorInput());
|
||||||
return fOutlinePage;
|
return fOutlinePage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,6 +2567,16 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void setOutlinePageInputIfNotSame(CContentOutlinePage page, IEditorInput input) {
|
||||||
|
if (page != null) {
|
||||||
|
IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager();
|
||||||
|
IWorkingCopy workingCopy = manager.getWorkingCopy(input);
|
||||||
|
if (workingCopy != page.getRoot()) {
|
||||||
|
page.setInput(workingCopy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if folding is enabled.
|
* Determines if folding is enabled.
|
||||||
* @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
|
* @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
|
* Martin Oberhuber (Wind River) - bug 398195: consider external API in IB
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.includebrowser;
|
package org.eclipse.cdt.internal.ui.includebrowser;
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ import org.eclipse.ui.part.ViewPart;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
@ -214,7 +216,8 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
final ICProject[] projects= CoreModel.getDefault().getCModel().getCProjects();
|
final ICProject[] projects= CoreModel.getDefault().getCModel().getCProjects();
|
||||||
IIndex index= CCorePlugin.getIndexManager().getIndex(projects);
|
IIndex index= CCorePlugin.getIndexManager().getIndex(projects,
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
if (!IndexUI.isIndexed(index, input)) {
|
if (!IndexUI.isIndexed(index, input)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
|
* Martin Oberhuber (Wind River) - bug 398195: consider external API in IB
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.includebrowser;
|
package org.eclipse.cdt.internal.ui.includebrowser;
|
||||||
|
@ -21,6 +22,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IIndexInclude;
|
import org.eclipse.cdt.core.index.IIndexInclude;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
@ -70,7 +72,8 @@ public class IncludeBrowserUI {
|
||||||
private static ITranslationUnit findTargetTranslationUnit(IInclude input) throws CoreException, InterruptedException {
|
private static ITranslationUnit findTargetTranslationUnit(IInclude input) throws CoreException, InterruptedException {
|
||||||
ICProject project= input.getCProject();
|
ICProject project= input.getCProject();
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
IIndex index= CCorePlugin.getIndexManager().getIndex(project);
|
IIndex index= CCorePlugin.getIndexManager().getIndex(project,
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
IIndexInclude include= IndexUI.elementToInclude(index, input);
|
IIndexInclude include= IndexUI.elementToInclude(index, input);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2011 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,7 +10,6 @@
|
||||||
* Anton Leherbauer (Wind River Systems
|
* Anton Leherbauer (Wind River Systems
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.preferences;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
@ -81,7 +80,6 @@ import org.eclipse.cdt.internal.ui.text.util.CColorManager;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item in the highlighting color list.
|
* Item in the highlighting color list.
|
||||||
*/
|
*/
|
||||||
|
@ -161,7 +159,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
|
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
|
||||||
|
|
||||||
/** Enablement preference key */
|
/** Enablement preference key */
|
||||||
private final String fEnableKey;
|
private final String fEnableKey;
|
||||||
|
|
||||||
|
@ -175,7 +172,8 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* @param underlineKey the underlineKey preference key
|
* @param underlineKey the underlineKey preference key
|
||||||
* @param enableKey the enable preference key
|
* @param enableKey the enable preference key
|
||||||
*/
|
*/
|
||||||
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
|
public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey,
|
||||||
|
String italicKey, String strikethroughKey, String underlineKey, String enableKey) {
|
||||||
super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
|
super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
|
||||||
fEnableKey= enableKey;
|
fEnableKey= enableKey;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +190,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* Color list label provider.
|
* Color list label provider.
|
||||||
*/
|
*/
|
||||||
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof String)
|
if (element instanceof String)
|
||||||
|
@ -202,17 +197,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
return ((HighlightingColorListItem)element).getDisplayName();
|
return ((HighlightingColorListItem)element).getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getBackground(Object element) {
|
public Color getBackground(Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getForeground(Object element) {
|
public Color getForeground(Object element) {
|
||||||
if (element instanceof SemanticHighlightingColorListItem) {
|
if (element instanceof SemanticHighlightingColorListItem) {
|
||||||
|
@ -228,25 +217,15 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
* Color list content provider.
|
* Color list content provider.
|
||||||
*/
|
*/
|
||||||
private class ColorListContentProvider implements ITreeContentProvider {
|
private class ColorListContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
|
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
}
|
}
|
||||||
|
@ -564,7 +543,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Control createSyntaxPage(final Composite parent) {
|
private Control createSyntaxPage(final Composite parent) {
|
||||||
|
|
||||||
Composite colorComposite= new Composite(parent, SWT.NONE);
|
Composite colorComposite= new Composite(parent, SWT.NONE);
|
||||||
GridLayout layout= new GridLayout();
|
GridLayout layout= new GridLayout();
|
||||||
layout.marginHeight= 0;
|
layout.marginHeight= 0;
|
||||||
|
@ -912,11 +890,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
{ createHighlightedRange(13, 16, 4, SemanticHighlightings.ENUMERATOR) },
|
{ createHighlightedRange(13, 16, 4, SemanticHighlightings.ENUMERATOR) },
|
||||||
{ createHighlightedRange(13, 22, 3, SemanticHighlightings.ENUMERATOR) },
|
{ createHighlightedRange(13, 22, 3, SemanticHighlightings.ENUMERATOR) },
|
||||||
{ createHighlightedRange(13, 27, 3, SemanticHighlightings.ENUMERATOR) },
|
{ createHighlightedRange(13, 27, 3, SemanticHighlightings.ENUMERATOR) },
|
||||||
{ createHighlightedRange(14, 14, 11, SemanticHighlightings.STATIC_FIELD), createHighlightedRange(13, 14, 11, SemanticHighlightings.FIELD) },
|
{ createHighlightedRange(14, 14, 11, SemanticHighlightings.STATIC_FIELD), createHighlightedRange(14, 14, 11, SemanticHighlightings.FIELD) },
|
||||||
{ createHighlightedRange(15, 6, 5, SemanticHighlightings.FIELD) },
|
{ createHighlightedRange(15, 6, 5, SemanticHighlightings.FIELD) },
|
||||||
{ createHighlightedRange(16, 10, 6, SemanticHighlightings.ENUM) },
|
{ createHighlightedRange(16, 10, 6, SemanticHighlightings.ENUM) },
|
||||||
{ createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(15, 17, 7, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD) },
|
||||||
{ createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(16, 7, 6, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD) },
|
||||||
{ createHighlightedRange(17, 14, 6, SemanticHighlightings.ENUM) },
|
{ createHighlightedRange(17, 14, 6, SemanticHighlightings.ENUM) },
|
||||||
{ createHighlightedRange(17, 21, 1, SemanticHighlightings.PARAMETER_VARIABLE) },
|
{ createHighlightedRange(17, 21, 1, SemanticHighlightings.PARAMETER_VARIABLE) },
|
||||||
{ createHighlightedRange(18, 8, 5, SemanticHighlightings.LOCAL_VARIABLE_DECLARATION) },
|
{ createHighlightedRange(18, 8, 5, SemanticHighlightings.LOCAL_VARIABLE_DECLARATION) },
|
||||||
|
@ -925,9 +903,9 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
{ createHighlightedRange(19, 7, 6, SemanticHighlightings.FUNCTION) },
|
{ createHighlightedRange(19, 7, 6, SemanticHighlightings.FUNCTION) },
|
||||||
{ createHighlightedRange(19, 14, 5, SemanticHighlightings.LOCAL_VARIABLE) },
|
{ createHighlightedRange(19, 14, 5, SemanticHighlightings.LOCAL_VARIABLE) },
|
||||||
{ createHighlightedRange(20, 4, 7, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(20, 4, 7, SemanticHighlightings.METHOD) },
|
||||||
{ createHighlightedRange(21, 4, 12, SemanticHighlightings.STATIC_METHOD_INVOCATION), createHighlightedRange(20, 4, 12, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(21, 4, 12, SemanticHighlightings.STATIC_METHOD_INVOCATION), createHighlightedRange(21, 4, 12, SemanticHighlightings.METHOD) },
|
||||||
{ createHighlightedRange(22, 4, 7, SemanticHighlightings.PROBLEM) },
|
{ createHighlightedRange(22, 4, 7, SemanticHighlightings.PROBLEM) },
|
||||||
{ createHighlightedRange(24, 14, 12, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(23, 14, 12, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(24, 14, 12, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(24, 14, 12, SemanticHighlightings.METHOD) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.preferences;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -19,8 +18,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code coloring preference page.
|
* Code coloring preference page.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -30,41 +27,27 @@ import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
|
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHelpId() {
|
protected String getHelpId() {
|
||||||
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
|
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDescription() {
|
protected void setDescription() {
|
||||||
String description= PreferencesMessages.CEditorPreferencePage_colors;
|
String description= PreferencesMessages.CEditorPreferencePage_colors;
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Label createDescriptionLabel(Composite parent) {
|
protected Label createDescriptionLabel(Composite parent) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setPreferenceStore() {
|
protected void setPreferenceStore() {
|
||||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
|
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
|
||||||
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);
|
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);
|
||||||
|
|
|
@ -1409,8 +1409,17 @@ public final class CIndenter {
|
||||||
case Symbols.TokenPRIVATE:
|
case Symbols.TokenPRIVATE:
|
||||||
case Symbols.TokenPROTECTED:
|
case Symbols.TokenPROTECTED:
|
||||||
case Symbols.TokenPUBLIC:
|
case Symbols.TokenPUBLIC:
|
||||||
case Symbols.TokenVIRTUAL:
|
|
||||||
continue; // Don't stop at colon in a class declaration
|
continue; // Don't stop at colon in a class declaration
|
||||||
|
|
||||||
|
case Symbols.TokenVIRTUAL:
|
||||||
|
switch (peekToken()) {
|
||||||
|
case Symbols.TokenPRIVATE:
|
||||||
|
case Symbols.TokenPROTECTED:
|
||||||
|
case Symbols.TokenPUBLIC:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int pos= fPreviousPos;
|
int pos= fPreviousPos;
|
||||||
if (!isConditional())
|
if (!isConditional())
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class CPreprocessorScanner extends AbstractCScanner {
|
public class CPreprocessorScanner extends AbstractCScanner {
|
||||||
|
|
||||||
/** Properties for tokens. */
|
/** Properties for tokens. */
|
||||||
private static String[] fgTokenProperties= {
|
private static String[] fgTokenProperties= {
|
||||||
ICColorConstants.C_KEYWORD,
|
ICColorConstants.C_KEYWORD,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2011 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
* QNX Software System
|
* QNX Software System
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text;
|
package org.eclipse.cdt.internal.ui.text;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.rules.ICharacterScanner;
|
import org.eclipse.jface.text.rules.ICharacterScanner;
|
||||||
|
@ -24,13 +24,11 @@ import org.eclipse.jface.text.rules.Token;
|
||||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This scanner recognizes the C multi line comments, C single line comments,
|
* This scanner recognizes the C multi line comments, C single line comments,
|
||||||
* C strings, C characters and C preprocessor directives.
|
* C strings, C characters and C preprocessor directives.
|
||||||
*/
|
*/
|
||||||
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
||||||
|
|
||||||
// states
|
// states
|
||||||
private static final int CCODE= 0;
|
private static final int CCODE= 0;
|
||||||
private static final int SINGLE_LINE_COMMENT= 1;
|
private static final int SINGLE_LINE_COMMENT= 1;
|
||||||
|
@ -115,7 +113,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IToken nextToken() {
|
public IToken nextToken() {
|
||||||
|
|
||||||
fTokenOffset += fTokenLength;
|
fTokenOffset += fTokenLength;
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
|
|
||||||
|
@ -135,7 +132,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fLast= NONE; // ignore last
|
fLast= NONE; // ignore last
|
||||||
if (fTokenLength > 0) {
|
if (fTokenLength > 0) {
|
||||||
return preFix(fState, CCODE, NONE, 0);
|
return preFix(fState, CCODE, NONE, 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fPrefixLength= 0;
|
fPrefixLength= 0;
|
||||||
return Token.EOF;
|
return Token.EOF;
|
||||||
|
@ -165,7 +161,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
|
|
||||||
fState= CCODE;
|
fState= CCODE;
|
||||||
return token;
|
return token;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
consume();
|
consume();
|
||||||
continue;
|
continue;
|
||||||
|
@ -220,7 +215,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
case STRING:
|
case STRING:
|
||||||
case PREPROCESSOR:
|
case PREPROCESSOR:
|
||||||
case PREPROCESSOR_STRING:
|
case PREPROCESSOR_STRING:
|
||||||
|
|
||||||
int last;
|
int last;
|
||||||
int newState;
|
int newState;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
@ -304,7 +298,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fTokenLength++;
|
fTokenLength++;
|
||||||
fLast= SLASH;
|
fLast= SLASH;
|
||||||
|
@ -321,7 +314,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
fTokenLength= fPrefixLength;
|
fTokenLength= fPrefixLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
consume();
|
consume();
|
||||||
break;
|
break;
|
||||||
|
@ -527,15 +519,26 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
case RAW_STRING:
|
case RAW_STRING:
|
||||||
switch (rawStringState) {
|
switch (rawStringState) {
|
||||||
case OPEN_DELIMITER:
|
case OPEN_DELIMITER:
|
||||||
if (ch == '(') {
|
switch (ch) {
|
||||||
|
case '(':
|
||||||
rawStringState = RawStringState.CONTENT;
|
rawStringState = RawStringState.CONTENT;
|
||||||
} else if (ch == '"') {
|
break;
|
||||||
return postFix(RAW_STRING);
|
case ' ':
|
||||||
} else if (ch != ' ' && ch != '\\' && ch != ')' && fRawStringDelimiter.length() < 12) {
|
case '\\':
|
||||||
|
case ')':
|
||||||
|
case '\t':
|
||||||
|
case '\n':
|
||||||
|
case '\f':
|
||||||
|
case 11: // Vertical tab
|
||||||
|
fState = STRING;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (fRawStringDelimiter.length() < 12) {
|
||||||
fRawStringDelimiter.append((char) ch);
|
fRawStringDelimiter.append((char) ch);
|
||||||
} else {
|
} else {
|
||||||
fState = STRING;
|
fState = STRING;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
consume();
|
consume();
|
||||||
break;
|
break;
|
||||||
case CONTENT:
|
case CONTENT:
|
||||||
|
@ -603,7 +606,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
case BACKSLASH_CR:
|
case BACKSLASH_CR:
|
||||||
case BACKSLASH_BACKSLASH:
|
case BACKSLASH_BACKSLASH:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +626,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
return fTokens[interceptTokenState(state)];
|
return fTokens[interceptTokenState(state)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final IToken preFix(int state, int newState, int last, int prefixLength) {
|
private final IToken preFix(int state, int newState, int last, int prefixLength) {
|
||||||
fTokenLength -= getLastLength(fLast);
|
fTokenLength -= getLastLength(fLast);
|
||||||
fLast= last;
|
fLast= last;
|
||||||
|
@ -634,34 +635,26 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getState(String contentType) {
|
private static int getState(String contentType) {
|
||||||
|
if (contentType == null) {
|
||||||
if (contentType == null)
|
|
||||||
return CCODE;
|
return CCODE;
|
||||||
|
} else if (contentType.equals(C_SINGLE_LINE_COMMENT)) {
|
||||||
else if (contentType.equals(C_SINGLE_LINE_COMMENT))
|
|
||||||
return SINGLE_LINE_COMMENT;
|
return SINGLE_LINE_COMMENT;
|
||||||
|
} else if (contentType.equals(C_MULTI_LINE_COMMENT)) {
|
||||||
else if (contentType.equals(C_MULTI_LINE_COMMENT))
|
|
||||||
return MULTI_LINE_COMMENT;
|
return MULTI_LINE_COMMENT;
|
||||||
|
} else if (contentType.equals(C_STRING)) {
|
||||||
else if (contentType.equals(C_STRING))
|
|
||||||
return STRING;
|
return STRING;
|
||||||
|
} else if (contentType.equals(C_CHARACTER)) {
|
||||||
else if (contentType.equals(C_CHARACTER))
|
|
||||||
return CHARACTER;
|
return CHARACTER;
|
||||||
|
} else if (contentType.equals(C_PREPROCESSOR)) {
|
||||||
else if (contentType.equals(C_PREPROCESSOR))
|
|
||||||
return PREPROCESSOR;
|
return PREPROCESSOR;
|
||||||
|
} else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT)) {
|
||||||
else if (contentType.equals(C_SINGLE_LINE_DOC_COMMENT))
|
|
||||||
return SINGLE_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
return SINGLE_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
||||||
|
} else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT)) {
|
||||||
else if (contentType.equals(C_MULTI_LINE_DOC_COMMENT))
|
|
||||||
return MULTI_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
return MULTI_LINE_COMMENT; // intentionally non-doc state: the state machine is doc-comment unaware
|
||||||
|
} else {
|
||||||
else
|
|
||||||
return CCODE;
|
return CCODE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see IPartitionTokenScanner#setPartialRange(IDocument, int, int, String, int)
|
* @see IPartitionTokenScanner#setPartialRange(IDocument, int, int, String, int)
|
||||||
|
@ -705,9 +698,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ITokenScanner#setRange(IDocument, int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setRange(IDocument document, int offset, int length) {
|
public void setRange(IDocument document, int offset, int length) {
|
||||||
fDocument= document;
|
fDocument= document;
|
||||||
|
@ -743,15 +733,15 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
||||||
}
|
}
|
||||||
|
|
||||||
private int interceptTokenState(int proposedTokenState) {
|
private int interceptTokenState(int proposedTokenState) {
|
||||||
if(fOwner!=null) {
|
if (fOwner != null) {
|
||||||
switch(proposedTokenState) {
|
switch (proposedTokenState) {
|
||||||
case MULTI_LINE_COMMENT:
|
case MULTI_LINE_COMMENT:
|
||||||
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
if (fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||||
return MULTI_LINE_DOC_COMMENT;
|
return MULTI_LINE_DOC_COMMENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SINGLE_LINE_COMMENT:
|
case SINGLE_LINE_COMMENT:
|
||||||
if(fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
if (fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||||
return SINGLE_LINE_DOC_COMMENT;
|
return SINGLE_LINE_DOC_COMMENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
||||||
* A slightly adapted FastPartitioner.
|
* A slightly adapted FastPartitioner.
|
||||||
*/
|
*/
|
||||||
public class FastCPartitioner extends FastPartitioner {
|
public class FastCPartitioner extends FastPartitioner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new partitioner for the given content types.
|
* Creates a new partitioner for the given content types.
|
||||||
*
|
*
|
||||||
|
@ -72,7 +71,7 @@ public class FastCPartitioner extends FastPartitioner {
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public IDocCommentOwner getDocCommentOwner() {
|
public IDocCommentOwner getDocCommentOwner() {
|
||||||
if(fScanner instanceof FastCPartitionScanner) {
|
if (fScanner instanceof FastCPartitionScanner) {
|
||||||
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
|
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013, 2013 Andrew Gvozdev and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Andrew Gvozdev - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.jface.viewers.IDecoration;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if a file or folder got customized build settings and if so decorates with the "wrench" overlay.
|
||||||
|
*/
|
||||||
|
public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator {
|
||||||
|
@Override
|
||||||
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
|
if (element instanceof IFile || element instanceof IFolder) {
|
||||||
|
IResource rc = (IResource) element;
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(rc.getProject(), false);
|
||||||
|
if (prjDescription != null) {
|
||||||
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
|
if (cfgDescription != null) {
|
||||||
|
if (isCustomizedResource(cfgDescription, rc))
|
||||||
|
decoration.addOverlay(CPluginImages.DESC_OVR_SETTING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
||||||
|
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject())) {
|
||||||
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(rc.getProjectRelativePath(), true);
|
||||||
|
return rcDescription != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
for (ILanguageSettingsProvider provider: ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()) {
|
||||||
|
for (String languageId : LanguageSettingsManager.getLanguages(rc, cfgDescription)) {
|
||||||
|
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
||||||
|
if (list != null) {
|
||||||
|
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
||||||
|
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
||||||
|
if (list != listDefault)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addListener(ILabelProviderListener listener) {
|
||||||
|
// We don't track state changes
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
|
// We don't track state changes
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,10 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceStatus;
|
import org.eclipse.core.resources.IResourceStatus;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -30,20 +27,10 @@ import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ISourceRange;
|
import org.eclipse.cdt.core.model.ISourceRange;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
|
||||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
@ -98,7 +85,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
|
|
||||||
private static final int ERRORTICK_WARNING= CElementImageDescriptor.WARNING;
|
private static final int ERRORTICK_WARNING= CElementImageDescriptor.WARNING;
|
||||||
private static final int ERRORTICK_ERROR= CElementImageDescriptor.ERROR;
|
private static final int ERRORTICK_ERROR= CElementImageDescriptor.ERROR;
|
||||||
private static final int TICK_CONFIGURATION = CElementImageDescriptor.SETTINGS;
|
|
||||||
|
|
||||||
private ImageDescriptorRegistry fRegistry;
|
private ImageDescriptorRegistry fRegistry;
|
||||||
private boolean fUseNewRegistry= false;
|
private boolean fUseNewRegistry= false;
|
||||||
|
@ -114,15 +100,13 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
fUseNewRegistry= true;
|
fUseNewRegistry= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates decorator with a shared image registry.
|
* Creates decorator with a shared image registry.
|
||||||
|
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
||||||
*
|
*
|
||||||
* @param registry The registry to use or <code>null</code> to use the Java plugin's
|
* @param registry The registry to use or <code>null</code> to use the Java plugin's
|
||||||
* image registry.
|
* image registry.
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
|
||||||
*/
|
|
||||||
public ProblemsLabelDecorator(ImageDescriptorRegistry registry) {
|
public ProblemsLabelDecorator(ImageDescriptorRegistry registry) {
|
||||||
fRegistry= registry;
|
fRegistry= registry;
|
||||||
fProblemChangedListener= null;
|
fProblemChangedListener= null;
|
||||||
|
@ -136,17 +120,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ILabelDecorator#decorateText(String, Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String decorateText(String text, Object element) {
|
public String decorateText(String text, Object element) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ILabelDecorator#decorateImage(Image, Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Image decorateImage(Image image, Object obj) {
|
public Image decorateImage(Image image, Object obj) {
|
||||||
int adornmentFlags= computeAdornmentFlags(obj);
|
int adornmentFlags= computeAdornmentFlags(obj);
|
||||||
|
@ -169,9 +147,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ICElement.C_PROJECT:
|
case ICElement.C_PROJECT:
|
||||||
case ICElement.C_CCONTAINER:
|
case ICElement.C_CCONTAINER:
|
||||||
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null) | getTicks(element.getResource());
|
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null);
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null) | getTicks(element.getResource());
|
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null);
|
||||||
case ICElement.C_FUNCTION:
|
case ICElement.C_FUNCTION:
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
case ICElement.C_UNION:
|
case ICElement.C_UNION:
|
||||||
|
@ -185,14 +163,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (obj instanceof IResource) {
|
} else if (obj instanceof IResource) {
|
||||||
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null) | getTicks((IResource)obj);
|
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
if (e instanceof CModelException) {
|
|
||||||
// if (((CModelException) e).isDoesNotExist()) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) {
|
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -240,42 +213,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// private int getErrorTicksFromWorkingCopy(ITranslationUnit original, ISourceReference sourceElement) throws CoreException {
|
|
||||||
// int info= 0;
|
|
||||||
// FileEditorInput editorInput= new FileEditorInput((IFile) original.getResource());
|
|
||||||
// IAnnotationModel model= CUIPlugin.getDefault().getTranslationUnitDocumentProvider().getAnnotationModel(editorInput);
|
|
||||||
// if (model != null) {
|
|
||||||
// Iterator iter= model.getAnnotationIterator();
|
|
||||||
// while ((info != ERRORTICK_ERROR) && iter.hasNext()) {
|
|
||||||
// Annotation curr= (Annotation) iter.next();
|
|
||||||
// IMarker marker= isAnnotationInRange(model, curr, sourceElement);
|
|
||||||
// if (marker != null) {
|
|
||||||
// int priority= marker.getAttribute(IMarker.SEVERITY, -1);
|
|
||||||
// if (priority == IMarker.SEVERITY_WARNING) {
|
|
||||||
// info= ERRORTICK_WARNING;
|
|
||||||
// } else if (priority == IMarker.SEVERITY_ERROR) {
|
|
||||||
// info= ERRORTICK_ERROR;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return info;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private IMarker isAnnotationInRange(IAnnotationModel model, Annotation annot, ISourceReference sourceElement) throws CoreException {
|
|
||||||
// if (annot instanceof MarkerAnnotation) {
|
|
||||||
// IMarker marker= ((MarkerAnnotation) annot).getMarker();
|
|
||||||
// if (marker.exists() && marker.isSubtypeOf(IMarker.PROBLEM)) {
|
|
||||||
// Position pos= model.getPosition(annot);
|
|
||||||
// if (pos != null && (sourceElement == null || isInside(pos.getOffset(), -1, sourceElement))) {
|
|
||||||
// return marker;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if a position is inside the source range of an element. Usually this is done
|
* Tests if a position is inside the source range of an element. Usually this is done
|
||||||
* by looking at the offset. In case the offset equals <code>-1</code>, the line is
|
* by looking at the offset. In case the offset equals <code>-1</code>, the line is
|
||||||
|
@ -300,9 +237,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (fProblemChangedListener != null) {
|
if (fProblemChangedListener != null) {
|
||||||
|
@ -314,17 +248,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#isLabelProperty(Object, String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
if (fListeners == null) {
|
if (fListeners == null) {
|
||||||
|
@ -342,9 +270,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
if (fListeners != null) {
|
if (fListeners != null) {
|
||||||
|
@ -366,68 +291,14 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Object element, IDecoration decoration) {
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
int adornmentFlags= computeAdornmentFlags(element);
|
int adornmentFlags= computeAdornmentFlags(element);
|
||||||
|
|
||||||
if ((adornmentFlags & TICK_CONFIGURATION) != 0) {
|
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_SETTING);
|
|
||||||
adornmentFlags &= ~TICK_CONFIGURATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adornmentFlags == ERRORTICK_ERROR) {
|
if (adornmentFlags == ERRORTICK_ERROR) {
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_ERROR);
|
decoration.addOverlay(CPluginImages.DESC_OVR_ERROR);
|
||||||
} else if (adornmentFlags == ERRORTICK_WARNING) {
|
} else if (adornmentFlags == ERRORTICK_WARNING) {
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_WARNING);
|
decoration.addOverlay(CPluginImages.DESC_OVR_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
|
||||||
if (rc instanceof IProject)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject())) {
|
|
||||||
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(rc.getProjectRelativePath(), true);
|
|
||||||
return rcDescription != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
|
||||||
for (ILanguageSettingsProvider provider: ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()) {
|
|
||||||
for (String languageId : LanguageSettingsManager.getLanguages(rc, cfgDescription)) {
|
|
||||||
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
|
||||||
if (list != null) {
|
|
||||||
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
|
||||||
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
|
||||||
if (list != listDefault)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param rc - resource to check
|
|
||||||
* @return flags {@link TICK_CONFIGURATION} if the resource has custom settings and possibly needs
|
|
||||||
* to be adorned or 0 otherwise.
|
|
||||||
*/
|
|
||||||
private int getTicks (IResource rc) {
|
|
||||||
if (rc == null || rc instanceof IProject)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int result = 0;
|
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(rc.getProject(), false);
|
|
||||||
if (prjDescription != null) {
|
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
|
||||||
if (cfgDescription != null) {
|
|
||||||
if (isCustomizedResource(cfgDescription, rc))
|
|
||||||
result |= TICK_CONFIGURATION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -20,6 +20,7 @@ import org.eclipse.swt.graphics.ImageData;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.CustomBuildSettingsDecorator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,8 +105,12 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
||||||
/** Flag to render the 'external file' adornment for translation units */
|
/** Flag to render the 'external file' adornment for translation units */
|
||||||
public static final int EXTERNAL_FILE = 0x40000;
|
public static final int EXTERNAL_FILE = 0x40000;
|
||||||
|
|
||||||
/** Flag to render the 'custom settings' adornment
|
/** Flag to render the 'custom settings' adornment. Do not use, this flag has been discontinued.
|
||||||
* @since 5.2 */
|
* @since 5.2
|
||||||
|
* @deprecated The constant has been discontinued since CDT 8.1. The adornment moved to separate class
|
||||||
|
* {@link CustomBuildSettingsDecorator}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public final static int SETTINGS= 0x80000;
|
public final static int SETTINGS= 0x80000;
|
||||||
|
|
||||||
private ImageDescriptor fBaseImage;
|
private ImageDescriptor fBaseImage;
|
||||||
|
@ -243,11 +248,6 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
||||||
x -= data.width;
|
x -= data.width;
|
||||||
drawImage(data, x, 0);
|
drawImage(data, x, 0);
|
||||||
}
|
}
|
||||||
if ((fFlags & SETTINGS) != 0) {
|
|
||||||
data = CPluginImages.DESC_OVR_SETTING.getImageData();
|
|
||||||
x -= data.width;
|
|
||||||
drawImage(data, x, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawBottomRight() {
|
private void drawBottomRight() {
|
||||||
|
|
|
@ -128,17 +128,17 @@
|
||||||
<!-- Adapters for contextual launch -->
|
<!-- Adapters for contextual launch -->
|
||||||
<extension point="org.eclipse.core.runtime.adapters">
|
<extension point="org.eclipse.core.runtime.adapters">
|
||||||
<factory
|
<factory
|
||||||
class=""
|
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.core.model.IBinary">
|
adaptableType="org.eclipse.cdt.core.model.IBinary">
|
||||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||||
</factory>
|
</factory>
|
||||||
<factory
|
<factory
|
||||||
class=""
|
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||||
adaptableType="org.eclipse.core.resources.IResource">
|
adaptableType="org.eclipse.core.resources.IResource">
|
||||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||||
</factory>
|
</factory>
|
||||||
<factory
|
<factory
|
||||||
class=""
|
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.core.model.ICProject">
|
adaptableType="org.eclipse.cdt.core.model.ICProject">
|
||||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||||
</factory>
|
</factory>
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Wind River Systems - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.launch;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.debug.ui.actions.ILaunchable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an invalid Adapter factory which insures that there are no false
|
||||||
|
* usages of this class when defining ILaunchable contexts. Please reference
|
||||||
|
* the ILaunchable interface and Bugzilla : 396822.
|
||||||
|
*/
|
||||||
|
public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
|
||||||
|
|
||||||
|
private static final Class<?>[] TYPES = { ILaunchable.class };
|
||||||
|
|
||||||
|
private static ArrayList<String> currentTraces = new ArrayList<String>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||||
|
/*
|
||||||
|
* Calculate the trace to see if we already have seen this one. We only
|
||||||
|
* want to report new instances of the violation.
|
||||||
|
*/
|
||||||
|
String trace = getStackTrace();
|
||||||
|
|
||||||
|
if ( ! currentTraces.contains( trace ) ) {
|
||||||
|
/*
|
||||||
|
* Note we have seen this one for the first time.
|
||||||
|
*/
|
||||||
|
currentTraces.add( trace );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate a message for this in the log file.
|
||||||
|
*/
|
||||||
|
String msg = LaunchMessages.getString("Launch.ILaunchable.Interface.Error"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
CDebugUIPlugin.log( new Status( IStatus.INFO, CDebugUIPlugin.PLUGIN_ID, 0, msg, new Throwable( "" ) ) ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We do not actually provide an adapter factory for this.
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constructs the stack trace for comparison to see if we have seen this exact trace before.
|
||||||
|
* We only report each unique instance once.
|
||||||
|
*/
|
||||||
|
private String getStackTrace() {
|
||||||
|
String trace = ""; //$NON-NLS-1$
|
||||||
|
for (StackTraceElement elem : new Throwable().getStackTrace()) {
|
||||||
|
trace += elem.getClassName() + elem.getMethodName() + elem.getFileName() + elem.getLineNumber();
|
||||||
|
}
|
||||||
|
return trace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Indicates that we are adapting ILaunchable.
|
||||||
|
*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public Class[] getAdapterList() {
|
||||||
|
return TYPES;
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,3 +32,6 @@ CApplicationLaunchShortcut.Launch_failed_no_project_selected=Launch failed no pr
|
||||||
|
|
||||||
Launch.common.BinariesColon=Binaries:
|
Launch.common.BinariesColon=Binaries:
|
||||||
Launch.common.QualifierColon=Qualifier:
|
Launch.common.QualifierColon=Qualifier:
|
||||||
|
|
||||||
|
Launch.ILaunchable.Interface.Error=An attempt to instantiate an adapter factory for ILaunchable. By API specification this is not allowed. Use hasAdapter() to determine existense.
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
# Wind River Systems - initial API and implementation
|
# Wind River Systems - initial API and implementation
|
||||||
# IBM Corporation
|
# IBM Corporation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
output.tests.jar = bin/
|
|
||||||
bin.includes = fragment.xml,\
|
bin.includes = fragment.xml,\
|
||||||
META-INF/,\
|
META-INF/,\
|
||||||
.
|
.,\
|
||||||
|
data/,\
|
||||||
|
about.html
|
||||||
source.. = src/
|
source.. = src/
|
||||||
src.includes = about.html
|
src.includes = about.html
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
src = $(wildcard *.cc *.c)
|
src = $(wildcard *.cc *.c)
|
||||||
destDir = ../bin
|
destDir = ../bin
|
||||||
GCCFLAGS = -gdwarf-2 -pthread -m32
|
GCCFLAGS = -gdwarf-2 -pthread
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@mkdir -p $(destDir)
|
@mkdir -p $(destDir)
|
||||||
|
|
|
@ -21,8 +21,8 @@ unsigned int __stdcall PrintHello(void *threadid)
|
||||||
void *PrintHello(void *threadid)
|
void *PrintHello(void *threadid)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tid = (int)threadid;
|
long tid = (long)threadid;
|
||||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
printf("Hello World! It's me, thread #%ld!\n", tid);
|
||||||
SLEEP(2); // keep this thread around for a bit; the tests will check for its existence while the main thread is stopped at a breakpoint
|
SLEEP(2); // keep this thread around for a bit; the tests will check for its existence while the main thread is stopped at a breakpoint
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
|
@ -14,9 +14,9 @@ typedef pthread_t TID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set a breakpoint here so that both threads stop.
|
// Set a breakpoint here so that both threads stop.
|
||||||
void firstBreakpoint(int id)
|
void firstBreakpoint(long id)
|
||||||
{
|
{
|
||||||
printf("First breakpoint method from thread %d\n", id);
|
printf("First breakpoint method from thread %ld\n", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ unsigned int __stdcall PrintHello(void *threadid)
|
||||||
void *PrintHello(void *threadId)
|
void *PrintHello(void *threadId)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tId = (int)threadId;
|
long tId = (long)threadId;
|
||||||
firstBreakpoint(tId); // Stop a first time
|
firstBreakpoint(tId); // Stop a first time
|
||||||
|
|
||||||
SLEEP(1); // Keep state running a little
|
SLEEP(1); // Keep state running a little
|
||||||
|
|
|
@ -73,8 +73,8 @@ unsigned int __stdcall testTracepoints(void *threadid)
|
||||||
void *testTracepoints(void *threadid)
|
void *testTracepoints(void *threadid)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tid = (int)threadid;
|
long tid = (long)threadid;
|
||||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
printf("Hello World! It's me, thread #%ld!\n", tid);
|
||||||
|
|
||||||
int lIntVar = 12345;
|
int lIntVar = 12345;
|
||||||
double lDoubleVar = 12345.12345;
|
double lDoubleVar = 12345.12345;
|
||||||
|
|
|
@ -24,15 +24,53 @@
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>-->
|
</repositories>-->
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>production</id>
|
||||||
|
<properties>
|
||||||
|
<gdbPathOption>-Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb</gdbPathOption>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>clean</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<ant antfile="TestAppBuilder.xml" target="clean"/>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>prepare</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<ant antfile="TestAppBuilder.xml" target="makeTestApps"/>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-surefire-plugin</artifactId>
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useUIHarness>true</useUIHarness>
|
<useUIHarness>true</useUIHarness>
|
||||||
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
|
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M ${gdbPathOption}</argLine>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/AutomatedSuite.*</include>
|
<include>**/AutomatedSuite.*</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
|
|
@ -21,6 +21,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
||||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
|
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||||
|
@ -218,10 +220,10 @@ public class BaseTestCase {
|
||||||
protected void doLaunch() throws Exception {
|
protected void doLaunch() throws Exception {
|
||||||
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||||
|
|
||||||
System.out.println("====================================================================================================");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||||
System.out.println(String.format("Running test: %s using GDB: %s remote %s",
|
System.out.println(String.format("%s \"%s\" launching %s %s",
|
||||||
testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "on" : "off"));
|
GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : ""));
|
||||||
System.out.println("====================================================================================================");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||||
|
|
||||||
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
||||||
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||||
|
@ -320,7 +322,7 @@ public class BaseTestCase {
|
||||||
BufferedReader reader = new BufferedReader(r);
|
BufferedReader reader = new BufferedReader(r);
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
System.out.println(line);
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(line + "\n");
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if (line.startsWith("Listening on port")) {
|
if (line.startsWith("Listening on port")) {
|
||||||
break;
|
break;
|
||||||
|
@ -351,8 +353,15 @@ public class BaseTestCase {
|
||||||
public static void setGdbProgramNamesLaunchAttributes(String version) {
|
public static void setGdbProgramNamesLaunchAttributes(String version) {
|
||||||
// See bugzilla 303811 for why we have to append ".exe" on Windows
|
// See bugzilla 303811 for why we have to append ".exe" on Windows
|
||||||
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
|
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
|
||||||
setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb." + version + (isWindows ? ".exe" : ""));
|
String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path");
|
||||||
setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, "gdbserver." + version + (isWindows ? ".exe" : ""));
|
String debugName = "gdb." + version + (isWindows ? ".exe" : "");
|
||||||
|
String debugServerName = "gdbserver." + version + (isWindows ? ".exe" : "");
|
||||||
|
if (gdbPath != null) {
|
||||||
|
debugName = gdbPath + "/" + debugName;
|
||||||
|
debugServerName = gdbPath + "/" + debugServerName;
|
||||||
|
}
|
||||||
|
setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, debugName);
|
||||||
|
setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, debugServerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setGdbVersion() {
|
protected void setGdbVersion() {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.tests;
|
package org.eclipse.cdt.tests.dsf.gdb.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4.Suite_7_4;
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5.Suite_7_5;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import org.junit.runners.Suite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
Suite_7_4.class,
|
Suite_7_5.class,
|
||||||
// Can't run the Remote test just yet because they
|
// Can't run the Remote test just yet because they
|
||||||
// have the same names on the local tests, which is
|
// have the same names on the local tests, which is
|
||||||
// not handled by JUnit (https://bugs.eclipse.org/172256)
|
// not handled by JUnit (https://bugs.eclipse.org/172256)
|
||||||
|
|
|
@ -37,7 +37,8 @@ import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContex
|
||||||
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
|
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||||
import org.eclipse.cdt.dsf.internal.DsfPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||||
|
@ -240,7 +241,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsAddedEvent e) {
|
public void eventDispatched(IBreakpointsAddedEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp added event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event\n");
|
||||||
fBreakpointEvents[BP_ADDED]++;
|
fBreakpointEvents[BP_ADDED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -251,7 +252,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsUpdatedEvent e) {
|
public void eventDispatched(IBreakpointsUpdatedEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp updated event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event\n");
|
||||||
fBreakpointEvents[BP_UPDATED]++;
|
fBreakpointEvents[BP_UPDATED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -262,7 +263,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsRemovedEvent e) {
|
public void eventDispatched(IBreakpointsRemovedEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp removed event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event\n");
|
||||||
fBreakpointEvents[BP_REMOVED]++;
|
fBreakpointEvents[BP_REMOVED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -273,7 +274,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIBreakpointHitEvent e) {
|
public void eventDispatched(MIBreakpointHitEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp hit event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event\n");
|
||||||
fBreakpointEvents[BP_HIT]++;
|
fBreakpointEvents[BP_HIT]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
@ -284,7 +285,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIWatchpointTriggerEvent e) {
|
public void eventDispatched(MIWatchpointTriggerEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got wp hit event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp hit event\n");
|
||||||
fBreakpointEvents[WP_HIT]++;
|
fBreakpointEvents[WP_HIT]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
@ -295,7 +296,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIWatchpointScopeEvent e) {
|
public void eventDispatched(MIWatchpointScopeEvent e) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got wp scope event");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp scope event\n");
|
||||||
fBreakpointEvents[WP_OOS]++;
|
fBreakpointEvents[WP_OOS]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
|
|
@ -43,7 +43,8 @@ import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContex
|
||||||
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
|
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||||
import org.eclipse.cdt.dsf.internal.DsfPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||||
|
@ -225,7 +226,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_ADDED]++;
|
fBreakpointEvents[BP_ADDED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")\n");
|
||||||
fEventHandlerLock.notifyAll();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +236,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_UPDATED]++;
|
fBreakpointEvents[BP_UPDATED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")\n");
|
||||||
fEventHandlerLock.notifyAll();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +246,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_REMOVED]++;
|
fBreakpointEvents[BP_REMOVED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")\n");
|
||||||
fEventHandlerLock.notifyAll();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +256,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_HIT]++;
|
fBreakpointEvents[BP_HIT]++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
System.out.println(DsfPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")\n");
|
||||||
fEventHandlerLock.notifyAll();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -43,10 +42,12 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterNamesInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
|
||||||
|
@ -54,7 +55,6 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -62,18 +62,40 @@ import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@RunWith(BackgroundRunner.class)
|
@RunWith(BackgroundRunner.class)
|
||||||
public class MIRegistersTest extends BaseTestCase {
|
public class MIRegistersTest extends BaseTestCase {
|
||||||
|
// Static list of register names as obtained directly from GDB.
|
||||||
|
// We make it static it does not get re-set for every test
|
||||||
|
protected static List<String> fRegisterNames = null;
|
||||||
|
|
||||||
protected List<String> get_X86_REGS() {
|
protected List<String> get_X86_REGS() throws Throwable {
|
||||||
List<String> list = new LinkedList<String>(Arrays.asList("eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags",
|
if (fRegisterNames == null) {
|
||||||
"cs","ss","ds","es","fs","gs","st0","st1","st2","st3",
|
// The tests must run on different machines, so the set of registers can change.
|
||||||
"st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg",
|
// To deal with this we ask GDB for the list of registers.
|
||||||
"fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",
|
// Note that we send an MI Command in this code and do not use the IRegister service;
|
||||||
"mxcsr","orig_eax","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"));
|
// this is because we want to test the service later, comparing it to what we find
|
||||||
// On Windows, gdb doesn't report "orig_eax" as a register. Apparently it does on Linux
|
// by asking GDB directly.
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
Query<MIDataListRegisterNamesInfo> query = new Query<MIDataListRegisterNamesInfo>() {
|
||||||
list.remove("orig_eax");
|
@Override
|
||||||
|
protected void execute(DataRequestMonitor<MIDataListRegisterNamesInfo> rm) {
|
||||||
|
IMICommandControl controlService = fServicesTracker.getService(IMICommandControl.class);
|
||||||
|
controlService.queueCommand(
|
||||||
|
controlService.getCommandFactory().createMIDataListRegisterNames(fContainerDmc), rm);
|
||||||
}
|
}
|
||||||
return list;
|
};
|
||||||
|
fSession.getExecutor().execute(query);
|
||||||
|
|
||||||
|
MIDataListRegisterNamesInfo data = query.get();
|
||||||
|
String[] names = data.getRegisterNames();
|
||||||
|
|
||||||
|
// Remove registers with empty names since the service also
|
||||||
|
// remove them. I don't know why GDB returns such empty names.
|
||||||
|
fRegisterNames = new LinkedList<String>();
|
||||||
|
for (String name : names) {
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
fRegisterNames.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fRegisterNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -10,14 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.MIRegistersTest_7_1;
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.MIRegistersTest_7_1;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@RunWith(BackgroundRunner.class)
|
@RunWith(BackgroundRunner.class)
|
||||||
|
@ -26,23 +21,4 @@ public class MIRegistersTest_7_2 extends MIRegistersTest_7_1 {
|
||||||
protected void setGdbVersion() {
|
protected void setGdbVersion() {
|
||||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GDB's list of registers is different with GDB 7.2
|
|
||||||
@Override
|
|
||||||
protected List<String> get_X86_REGS() {
|
|
||||||
List<String> list = new LinkedList<String>(Arrays.asList("eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags",
|
|
||||||
"cs","ss","ds","es","fs","gs","st0","st1","st2","st3",
|
|
||||||
"st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg",
|
|
||||||
"fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",
|
|
||||||
"mxcsr",/*"","","","","","","","",*/"orig_eax",
|
|
||||||
"al","cl","dl","bl","ah","ch","dh","bh","ax","cx",
|
|
||||||
"dx","bx",/*"",*/"bp","si","di","mm0","mm1","mm2","mm3",
|
|
||||||
"mm4","mm5","mm6","mm7"));
|
|
||||||
// On Windows, gdb doesn't report "orig_eax" as a register. Apparently it does on Linux
|
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
|
||||||
list.remove("orig_eax");
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.junit.runners.Suite;
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
|
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
|
||||||
|
GDBMultiNonStopRunControlTest_7_5.class,
|
||||||
MIRegistersTest_7_5.class,
|
MIRegistersTest_7_5.class,
|
||||||
MIRunControlTest_7_5.class,
|
MIRunControlTest_7_5.class,
|
||||||
MIRunControlTargetAvailableTest_7_5.class,
|
MIRunControlTargetAvailableTest_7_5.class,
|
||||||
|
@ -45,7 +46,6 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_5.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_5.class,
|
||||||
PostMortemCoreTest_7_5.class,
|
PostMortemCoreTest_7_5.class,
|
||||||
CommandTimeoutTest_7_5.class,
|
CommandTimeoutTest_7_5.class,
|
||||||
GDBMultiNonStopRunControlTest_7_5.class,
|
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
GDBConsoleBreakpointsTest_7_5.class,
|
GDBConsoleBreakpointsTest_7_5.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.junit.runners.Suite;
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
|
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
|
||||||
|
GDBMultiNonStopRunControlTest_7_6.class,
|
||||||
GDBRemoteTracepointsTest_7_6.class,
|
GDBRemoteTracepointsTest_7_6.class,
|
||||||
MIRegistersTest_7_6.class,
|
MIRegistersTest_7_6.class,
|
||||||
MIRunControlTest_7_6.class,
|
MIRunControlTest_7_6.class,
|
||||||
|
@ -45,7 +46,6 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_6.class,
|
OperationsWhileTargetIsRunningTest_7_6.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_6.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_6.class,
|
||||||
CommandTimeoutTest_7_6.class,
|
CommandTimeoutTest_7_6.class,
|
||||||
GDBMultiNonStopRunControlTest_7_6.class,
|
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
GDBConsoleBreakpointsTest_7_6.class,
|
GDBConsoleBreakpointsTest_7_6.class,
|
||||||
TraceFileTest_7_6.class,
|
TraceFileTest_7_6.class,
|
||||||
|
|
|
@ -994,7 +994,11 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
CTabFolder tabFolder = fContextFolders.get(retrieval);
|
CTabFolder tabFolder = fContextFolders.get(retrieval);
|
||||||
if(tabFolder != null) {
|
if(tabFolder != null) {
|
||||||
fStackLayout.topControl = tabFolder;
|
fStackLayout.topControl = tabFolder;
|
||||||
handleTabActivated(tabFolder.getSelection());
|
CTabItem tabItem = (CTabItem) tabFolder.getSelection();
|
||||||
|
if ( tabItem != null ) {
|
||||||
|
getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
|
||||||
|
}
|
||||||
|
handleTabActivated(tabItem);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tabFolder = createTabFolder(fRenderingsComposite);
|
tabFolder = createTabFolder(fRenderingsComposite);
|
||||||
|
|
|
@ -7,17 +7,6 @@
|
||||||
name="%extension.name.0"
|
name="%extension.name.0"
|
||||||
point="org.eclipse.cdt.debug.ui.memory.transport.memoryTransport">
|
point="org.eclipse.cdt.debug.ui.memory.transport.memoryTransport">
|
||||||
|
|
||||||
<importer
|
|
||||||
name="%importer.name.0"
|
|
||||||
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter"
|
|
||||||
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter">
|
|
||||||
</importer>
|
|
||||||
<exporter
|
|
||||||
name="%exporter.name.0"
|
|
||||||
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter"
|
|
||||||
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter">
|
|
||||||
</exporter>
|
|
||||||
|
|
||||||
<importer
|
<importer
|
||||||
name="%importer.name.1"
|
name="%importer.name.1"
|
||||||
id="org.eclipse.cdt.debug.ui.memory.transport.PlainTextImporter"
|
id="org.eclipse.cdt.debug.ui.memory.transport.PlainTextImporter"
|
||||||
|
@ -40,6 +29,17 @@
|
||||||
class="org.eclipse.cdt.debug.ui.memory.transport.RAWBinaryExporter">
|
class="org.eclipse.cdt.debug.ui.memory.transport.RAWBinaryExporter">
|
||||||
</exporter>
|
</exporter>
|
||||||
|
|
||||||
|
<importer
|
||||||
|
name="%importer.name.0"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter"
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter">
|
||||||
|
</importer>
|
||||||
|
<exporter
|
||||||
|
name="%exporter.name.0"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter"
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter">
|
||||||
|
</exporter>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.ui.viewActions">
|
<extension point="org.eclipse.ui.viewActions">
|
||||||
|
|
|
@ -77,6 +77,13 @@
|
||||||
</appInfo>
|
</appInfo>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="maxmemorysize" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Maximum size of the addressable memory this exporter can support in bits.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
@ -109,6 +116,13 @@
|
||||||
</appInfo>
|
</appInfo>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="maxmemorysize" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Maximum size of the addressable memory this importer can support in bits.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -186,6 +187,33 @@ public class ExportMemoryDialog extends SelectionDialog
|
||||||
IConfigurationElement element = points[i];
|
IConfigurationElement element = points[i];
|
||||||
if("exporter".equals(element.getName())) //$NON-NLS-1$
|
if("exporter".equals(element.getName())) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
|
String maxSizeStr = element.getAttribute("maxmemorysize");
|
||||||
|
if ( maxSizeStr != null ) {
|
||||||
|
if ( fMemoryBlock instanceof IMemoryBlockExtension ) {
|
||||||
|
IMemoryBlockExtension memBlock = (IMemoryBlockExtension) fMemoryBlock;
|
||||||
|
try {
|
||||||
|
BigInteger endAddress = memBlock.getBigBaseAddress();
|
||||||
|
BigInteger length = memBlock.getBigLength();
|
||||||
|
if ( length != null && ! length.equals(new BigInteger("-1",10) ) ) {
|
||||||
|
endAddress = endAddress.add( length ) ;
|
||||||
|
}
|
||||||
|
int maxAddressSizeInBits = endAddress.bitLength();
|
||||||
|
int maxSupportedAddressSizeInBits = Integer.decode(maxSizeStr);
|
||||||
|
if ( maxAddressSizeInBits > maxSupportedAddressSizeInBits ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} catch (DebugException e1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int maxSupportedAddressSizeInBits = Integer.decode(maxSizeStr);
|
||||||
|
if ( maxSupportedAddressSizeInBits < 32 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
exporters.addElement((IMemoryExporter) element.createExecutableExtension("class")); //$NON-NLS-1$
|
exporters.addElement((IMemoryExporter) element.createExecutableExtension("class")); //$NON-NLS-1$
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
|
@ -219,6 +220,30 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
IConfigurationElement element = points[i];
|
IConfigurationElement element = points[i];
|
||||||
if("importer".equals(element.getName())) //$NON-NLS-1$
|
if("importer".equals(element.getName())) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
|
String maxSizeStr = element.getAttribute("maxmemorysize");
|
||||||
|
if ( maxSizeStr != null ) {
|
||||||
|
if ( fMemoryBlock instanceof IMemoryBlockExtension ) {
|
||||||
|
IMemoryBlockExtension memBlock = (IMemoryBlockExtension) fMemoryBlock;
|
||||||
|
try {
|
||||||
|
int maxAddressSizeInBits = memBlock.getAddressSize() * 8;
|
||||||
|
int maxSupportedAddressSizeInBits = Integer.decode(maxSizeStr);
|
||||||
|
if ( maxAddressSizeInBits > maxSupportedAddressSizeInBits ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} catch (DebugException e1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int maxSupportedAddressSizeInBits = Integer.decode(maxSizeStr);
|
||||||
|
if ( maxSupportedAddressSizeInBits < 32 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
importers.addElement(element.createExecutableExtension("class")); //$NON-NLS-1$
|
importers.addElement(element.createExecutableExtension("class")); //$NON-NLS-1$
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
fStartText = new Text(composite, SWT.BORDER);
|
fStartText = new Text(composite, SWT.BORDER);
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.left = new FormAttachment(startLabel);
|
data.left = new FormAttachment(startLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
// end address
|
// end address
|
||||||
|
@ -112,7 +112,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(endLabel);
|
data.left = new FormAttachment(endLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fEndText.setLayoutData(data);
|
fEndText.setLayoutData(data);
|
||||||
|
|
||||||
// length
|
// length
|
||||||
|
@ -128,7 +128,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(lengthLabel);
|
data.left = new FormAttachment(lengthLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fLengthText.setLayoutData(data);
|
fLengthText.setLayoutData(data);
|
||||||
|
|
||||||
// file
|
// file
|
||||||
|
@ -145,7 +145,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(fileLabel);
|
data.left = new FormAttachment(fileLabel);
|
||||||
data.width = 300;
|
data.width = 360;
|
||||||
fFileText.setLayoutData(data);
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||||
|
@ -160,10 +160,40 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
textValue = fProperties.get(TRANSFER_START);
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
textValue = fProperties.get(TRANSFER_END);
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
|
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger length = getEndAddress().subtract(getStartAddress());
|
||||||
|
fLengthText.setText(length.toString());
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fLengthText.setText("0");
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionAdapter() {
|
fileButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
@ -189,26 +219,38 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
|
|
||||||
fStartText.addKeyListener(new KeyListener() {
|
fStartText.addKeyListener(new KeyListener() {
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
boolean valid = true;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
BigInteger actualLength = getEndAddress().subtract(startAddress);
|
||||||
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
valid = false;
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
|
||||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
|
||||||
BigInteger startAddress = getStartAddress();
|
|
||||||
|
|
||||||
fLengthText.setText(endAddress.subtract(startAddress).toString());
|
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,20 +261,34 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||||
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
BigInteger endAddress = getEndAddress();
|
||||||
BigInteger startAddress = getStartAddress();
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
String lengthString = endAddress.subtract(startAddress).toString();
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
if(!fLengthText.getText().equals(lengthString))
|
|
||||||
fLengthText.setText(lengthString);
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
@ -246,23 +302,55 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BigInteger length = getLength();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
fStartText.setText(fStartText.getText().trim());
|
||||||
|
|
||||||
|
BigInteger length = getLength();
|
||||||
|
String endString;
|
||||||
BigInteger startAddress = getStartAddress();
|
BigInteger startAddress = getStartAddress();
|
||||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
BigInteger endAddress = startAddress.add(length);
|
||||||
if(!fEndText.getText().equals(endString))
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
endString = endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
fEndText.setText(endString);
|
fEndText.setText(endString);
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -273,19 +361,33 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to perform a validation. If we do it immediately we will get an exception
|
||||||
|
* because things are not totally setup. So we schedule an immediate running of the
|
||||||
|
* validation. For a very brief time the view logically may show a state which does
|
||||||
|
* not reflect the true state of affairs. But the validate immediately corrects the
|
||||||
|
* info. In practice the user never sees the invalid state displayed, because of the
|
||||||
|
* speed of the draw of the dialog.
|
||||||
|
*/
|
||||||
|
Display.getDefault().asyncExec(new Runnable(){
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getEndAddress()
|
public BigInteger getEndAddress()
|
||||||
{
|
{
|
||||||
String text = fEndText.getText();
|
String text = fEndText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -296,6 +398,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -306,6 +409,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
public BigInteger getLength()
|
public BigInteger getLength()
|
||||||
{
|
{
|
||||||
String text = fLengthText.getText();
|
String text = fLengthText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -325,7 +429,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
getEndAddress();
|
||||||
|
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
|
|
||||||
BigInteger length = getLength();
|
BigInteger length = getLength();
|
||||||
|
@ -333,8 +436,19 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().getParentFile().exists())
|
File file = getFile();
|
||||||
|
if ( file != null ) {
|
||||||
|
File parentFile = file.getParentFile();
|
||||||
|
|
||||||
|
if(parentFile != null && ! parentFile.exists() )
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if ( file.isDirectory() )
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -342,7 +456,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
fParentDialog.setValid(isValid);
|
fParentDialog.setValid(isValid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
data.left = new FormAttachment(labelStartText);
|
data.left = new FormAttachment(labelStartText);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
// file
|
// file
|
||||||
|
@ -226,9 +226,10 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
if(!getFile().exists())
|
if(!getFile().exists()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
@ -245,6 +246,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
fStartText = new Text(composite, SWT.BORDER);
|
fStartText = new Text(composite, SWT.BORDER);
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.left = new FormAttachment(startLabel);
|
data.left = new FormAttachment(startLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
// end address
|
// end address
|
||||||
|
@ -111,7 +111,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(endLabel);
|
data.left = new FormAttachment(endLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fEndText.setLayoutData(data);
|
fEndText.setLayoutData(data);
|
||||||
|
|
||||||
// length
|
// length
|
||||||
|
@ -127,7 +127,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(lengthLabel);
|
data.left = new FormAttachment(lengthLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fLengthText.setLayoutData(data);
|
fLengthText.setLayoutData(data);
|
||||||
|
|
||||||
// file
|
// file
|
||||||
|
@ -144,7 +144,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(fileLabel);
|
data.left = new FormAttachment(fileLabel);
|
||||||
data.width = 300;
|
data.width = 360;
|
||||||
fFileText.setLayoutData(data);
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||||
|
@ -159,10 +159,40 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
textValue = fProperties.get(TRANSFER_START);
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
textValue = fProperties.get(TRANSFER_END);
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
|
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger length = getEndAddress().subtract(getStartAddress());
|
||||||
|
fLengthText.setText(length.toString());
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fLengthText.setText("0");
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
@ -190,26 +220,38 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
|
|
||||||
fStartText.addKeyListener(new KeyListener() {
|
fStartText.addKeyListener(new KeyListener() {
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
boolean valid = true;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
BigInteger actualLength = getEndAddress().subtract(startAddress);
|
||||||
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
valid = false;
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
|
||||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
|
||||||
BigInteger startAddress = getStartAddress();
|
|
||||||
|
|
||||||
fLengthText.setText(endAddress.subtract(startAddress).toString());
|
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,20 +262,34 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||||
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
BigInteger endAddress = getEndAddress();
|
||||||
BigInteger startAddress = getStartAddress();
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
String lengthString = endAddress.subtract(startAddress).toString();
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
if(!fLengthText.getText().equals(lengthString))
|
|
||||||
fLengthText.setText(lengthString);
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
@ -247,23 +303,55 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BigInteger length = getLength();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
fStartText.setText(fStartText.getText().trim());
|
||||||
|
|
||||||
|
BigInteger length = getLength();
|
||||||
|
String endString;
|
||||||
BigInteger startAddress = getStartAddress();
|
BigInteger startAddress = getStartAddress();
|
||||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
BigInteger endAddress = startAddress.add(length);
|
||||||
if(!fEndText.getText().equals(endString))
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
endString = endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
fEndText.setText(endString);
|
fEndText.setText(endString);
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -274,9 +362,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
|
@ -303,6 +389,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
public BigInteger getEndAddress()
|
public BigInteger getEndAddress()
|
||||||
{
|
{
|
||||||
String text = fEndText.getText();
|
String text = fEndText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -313,6 +400,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -323,6 +411,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
public BigInteger getLength()
|
public BigInteger getLength()
|
||||||
{
|
{
|
||||||
String text = fLengthText.getText();
|
String text = fLengthText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -342,7 +431,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
getEndAddress();
|
||||||
|
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
|
|
||||||
BigInteger length = getLength();
|
BigInteger length = getLength();
|
||||||
|
@ -350,8 +438,19 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().getParentFile().exists())
|
File file = getFile();
|
||||||
|
if ( file != null ) {
|
||||||
|
File parentFile = file.getParentFile();
|
||||||
|
|
||||||
|
if(parentFile != null && ! parentFile.exists() )
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if ( file.isDirectory() )
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +460,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
fParentDialog.setValid(isValid);
|
fParentDialog.setValid(isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return "rawbinary"; //$NON-NLS-1$
|
return "rawbinary"; //$NON-NLS-1$
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
fStartText = new Text(composite, SWT.BORDER);
|
fStartText = new Text(composite, SWT.BORDER);
|
||||||
FormData data = new FormData();
|
FormData data = new FormData();
|
||||||
data.left = new FormAttachment(labelStartText);
|
data.left = new FormAttachment(labelStartText);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
// file
|
// file
|
||||||
|
@ -206,9 +206,10 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
if(!getFile().exists())
|
if(!getFile().exists()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
@ -225,6 +226,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
fStartText = new Text(composite, SWT.BORDER);
|
fStartText = new Text(composite, SWT.BORDER);
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.left = new FormAttachment(startLabel);
|
data.left = new FormAttachment(startLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
// end address
|
// end address
|
||||||
|
@ -114,7 +114,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(endLabel);
|
data.left = new FormAttachment(endLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fEndText.setLayoutData(data);
|
fEndText.setLayoutData(data);
|
||||||
|
|
||||||
// length
|
// length
|
||||||
|
@ -130,7 +130,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(lengthLabel);
|
data.left = new FormAttachment(lengthLabel);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fLengthText.setLayoutData(data);
|
fLengthText.setLayoutData(data);
|
||||||
|
|
||||||
// file
|
// file
|
||||||
|
@ -147,7 +147,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(fileLabel);
|
data.left = new FormAttachment(fileLabel);
|
||||||
data.width = 300;
|
data.width = 360;
|
||||||
fFileText.setLayoutData(data);
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||||
|
@ -156,6 +156,24 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
// Restriction notice about 32-bit support
|
||||||
|
|
||||||
|
Label spacingLabel = new Label(composite, SWT.NONE);
|
||||||
|
|
||||||
|
spacingLabel.setText(""); //$NON-NLS-1$
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
data.top = new FormAttachment(fileLabel);
|
||||||
|
spacingLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
Label restrictionLabel = new Label(composite, SWT.NONE);
|
||||||
|
|
||||||
|
restrictionLabel.setText(Messages.getString("SRecordExporter.32BitLimitationMessage")); //$NON-NLS-1$
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
data.top = new FormAttachment(spacingLabel);
|
||||||
|
restrictionLabel.setLayoutData(data);
|
||||||
|
|
||||||
String textValue = fProperties.get(TRANSFER_FILE);
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -171,7 +189,6 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
textValue = fProperties.get(TRANSFER_END);
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -186,7 +203,11 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
BigInteger length = getEndAddress().subtract(getStartAddress());
|
||||||
|
fLengthText.setText(length.toString());
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -225,21 +246,36 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
String lengthString = actualLength.toString();
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
if(!fLengthText.getText().equals(lengthString)) {
|
BigInteger startAddress = getStartAddress();
|
||||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
BigInteger actualLength = getEndAddress().subtract(startAddress);
|
||||||
fLengthText.setText(lengthString);
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
validate();
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
validate();
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {}
|
public void keyPressed(KeyEvent e) {}
|
||||||
|
@ -249,24 +285,37 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||||
String lengthString = actualLength.toString();
|
fLengthText.setText(actualLength.toString());
|
||||||
|
|
||||||
if(!fLengthText.getText().equals(lengthString)) {
|
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
fLengthText.setText(lengthString);
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
BigInteger startAddress = getStartAddress();
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
validate();
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {}
|
public void keyPressed(KeyEvent e) {}
|
||||||
|
@ -277,21 +326,53 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BigInteger length = getLength();
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
|
|
||||||
if(!fEndText.getText().equals(endString)) {
|
fStartText.setText(fStartText.getText().trim());
|
||||||
if ( ! length.equals( BigInteger.ZERO ) ) {
|
|
||||||
|
BigInteger length = getLength();
|
||||||
|
String endString;
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
BigInteger endAddress = startAddress.add(length);
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
endString = endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
fEndText.setText(endString);
|
fEndText.setText(endString);
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
validate();
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||||
validate();
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
|
@ -333,6 +414,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
public BigInteger getEndAddress()
|
public BigInteger getEndAddress()
|
||||||
{
|
{
|
||||||
String text = fEndText.getText();
|
String text = fEndText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -347,6 +429,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -361,6 +444,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
public BigInteger getLength()
|
public BigInteger getLength()
|
||||||
{
|
{
|
||||||
String text = fLengthText.getText();
|
String text = fLengthText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -381,7 +465,6 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
getEndAddress();
|
||||||
|
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
|
|
||||||
BigInteger length = getLength();
|
BigInteger length = getLength();
|
||||||
|
@ -389,8 +472,19 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().getParentFile().exists())
|
File file = getFile();
|
||||||
|
if ( file != null ) {
|
||||||
|
File parentFile = file.getParentFile();
|
||||||
|
|
||||||
|
if(parentFile != null && ! parentFile.exists() )
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if ( file.isDirectory() )
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -400,7 +494,6 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
fParentDialog.setValid(isValid);
|
fParentDialog.setValid(isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return "srecord"; //$NON-NLS-1$
|
return "srecord"; //$NON-NLS-1$
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
data.left = new FormAttachment(fComboRestoreToThisAddress);
|
data.left = new FormAttachment(fComboRestoreToThisAddress);
|
||||||
data.width = 100;
|
data.width = 120;
|
||||||
fStartText.setLayoutData(data);
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
fComboRestoreToFileAddress.addSelectionListener(new SelectionListener() {
|
fComboRestoreToFileAddress.addSelectionListener(new SelectionListener() {
|
||||||
|
@ -247,6 +247,24 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||||
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
||||||
|
|
||||||
|
// Restriction notice about 32-bit support
|
||||||
|
|
||||||
|
Label spacingLabel = new Label(composite, SWT.NONE);
|
||||||
|
|
||||||
|
spacingLabel.setText(""); //$NON-NLS-1$
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
data.top = new FormAttachment(fScrollToBeginningOnImportComplete);
|
||||||
|
spacingLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
Label restrictionLabel = new Label(composite, SWT.NONE);
|
||||||
|
|
||||||
|
restrictionLabel.setText(Messages.getString("SRecordImporter.32BitLimitationMessage")); //$NON-NLS-1$
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
data.top = new FormAttachment(spacingLabel);
|
||||||
|
restrictionLabel.setLayoutData(data);
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
parent.pack();
|
parent.pack();
|
||||||
|
|
||||||
|
@ -294,6 +312,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = fStartText.getText();
|
String text = fStartText.getText();
|
||||||
|
text = text.trim();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
|
|
@ -51,6 +51,7 @@ SRecordExporter.EndAddress=End address:
|
||||||
SRecordExporter.Length=Length:
|
SRecordExporter.Length=Length:
|
||||||
SRecordExporter.Name=SRecord
|
SRecordExporter.Name=SRecord
|
||||||
SRecordExporter.StartAddress=Start address:
|
SRecordExporter.StartAddress=Start address:
|
||||||
|
SRecordExporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||||
|
|
||||||
SRecordImporter.ChecksumFalure=Checksum failure of line =
|
SRecordImporter.ChecksumFalure=Checksum failure of line =
|
||||||
SRecordImporter.ChooseFile=Choose memory import file
|
SRecordImporter.ChooseFile=Choose memory import file
|
||||||
|
@ -62,6 +63,7 @@ SRecordImporter.InvalidData=Invalid file format. Invalid data at line %d
|
||||||
SRecordImporter.InvalidLineLength=Invalid file format. Invalid line length at line %d
|
SRecordImporter.InvalidLineLength=Invalid file format. Invalid line length at line %d
|
||||||
SRecordImporter.Name=SRecord
|
SRecordImporter.Name=SRecord
|
||||||
SRecordImporter.ScrollToStart=Scroll to restore address
|
SRecordImporter.ScrollToStart=Scroll to restore address
|
||||||
|
SRecordImporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||||
|
|
||||||
RAWBinaryExporter.ChooseFile=Choose memory export file
|
RAWBinaryExporter.ChooseFile=Choose memory export file
|
||||||
RAWBinaryExporter.EndAddress=End address:
|
RAWBinaryExporter.EndAddress=End address:
|
||||||
|
|
|
@ -6,6 +6,7 @@ Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.qt.core.Activator
|
Bundle-Activator: org.eclipse.cdt.qt.core.Activator
|
||||||
Bundle-Vendor: Eclipse CDT
|
Bundle-Vendor: Eclipse CDT
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
|
org.eclipse.core.resources;bundle-version="3.8.100",
|
||||||
org.eclipse.cdt.core
|
org.eclipse.cdt.core
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
|
|
@ -41,4 +41,13 @@
|
||||||
priority="normal">
|
priority="normal">
|
||||||
</content-type>
|
</content-type>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="qtNature"
|
||||||
|
point="org.eclipse.core.resources.natures">
|
||||||
|
<runtime>
|
||||||
|
<run
|
||||||
|
class="org.eclipse.cdt.qt.core.QtNature">
|
||||||
|
</run>
|
||||||
|
</runtime>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Doug Schaefer (QNX) - Initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.qt.core;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectNature;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
public class QtNature implements IProjectNature {
|
||||||
|
public static final String ID = "org.eclipse.cdt.qt.core.qtNature";
|
||||||
|
|
||||||
|
private IProject project;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure() throws CoreException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deconfigure() throws CoreException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IProject getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProject(IProject project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ Rectangle {
|
||||||
width: 360
|
width: 360
|
||||||
height: 360
|
height: 360
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Hello World")
|
text: qsTr("Hello World from $(baseName)")
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
@ -6,7 +6,7 @@ clean: clean-debug clean-release
|
||||||
|
|
||||||
build-debug/Makefile:
|
build-debug/Makefile:
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(QMAKE) -o $@ clangtest.pro CONFIG+=debug
|
$(QMAKE) -o $@ {{baseName}}.pro CONFIG+=debug
|
||||||
|
|
||||||
debug: build-debug/Makefile
|
debug: build-debug/Makefile
|
||||||
$(MAKE) -w -C build-debug
|
$(MAKE) -w -C build-debug
|
||||||
|
@ -16,7 +16,7 @@ clean-debug:
|
||||||
|
|
||||||
build-release/Makefile:
|
build-release/Makefile:
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(QMAKE) -o $@ clangtest.pro CONFIG+=release
|
$(QMAKE) -o $@ {{baseName}}.pro CONFIG+=release
|
||||||
|
|
||||||
release: build-release/Makefile
|
release: build-release/Makefile
|
||||||
$(MAKE) -w -C build-release
|
$(MAKE) -w -C build-release
|
||||||
|
|
|
@ -57,5 +57,9 @@
|
||||||
</complex-array>
|
</complex-array>
|
||||||
</process>
|
</process>
|
||||||
|
|
||||||
</template>
|
<process type="org.eclipse.cdt.core.AddNature">
|
||||||
|
<simple name="projectName" value="$(projectName)"/>
|
||||||
|
<simple name="natureId" value="org.eclipse.cdt.qt.core.qtNature"/>
|
||||||
|
</process>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
Loading…
Add table
Reference in a new issue