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 static enum Type{PACKAGE, HEADER, PROG, FILE, GENERIC}
|
||||
public static enum Type{PACKAGE, HEADER, PROG, LIB, FILE, GENERIC}
|
||||
|
||||
private ProblemMarkerInfo marker;
|
||||
|
||||
|
|
|
@ -175,6 +175,8 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
|||
return AutotoolsProblemMarkerInfo.Type.HEADER;
|
||||
if (typeString.equals("file"))
|
||||
return AutotoolsProblemMarkerInfo.Type.FILE;
|
||||
if (typeString.equals("lib"))
|
||||
return AutotoolsProblemMarkerInfo.Type.LIB;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2522,7 +2522,13 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
|
|||
* The function never returns number smaller than 1.
|
||||
*/
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -12,7 +12,9 @@
|
|||
package org.eclipse.cdt.managedbuilder.internal.language.settings.providers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -59,7 +61,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
|||
languageSettings = getLanguageSettings(rcDescription);
|
||||
}
|
||||
|
||||
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
||||
Set<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
||||
|
||||
if (languageSettings != null) {
|
||||
for (ICLanguageSetting langSetting : languageSettings) {
|
||||
|
@ -86,8 +88,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
|||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||
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());
|
||||
if (! list.contains(projectRootedEntry)) {
|
||||
list.add(projectRootedEntry);
|
||||
if (!set.contains(projectRootedEntry)) {
|
||||
set.add(projectRootedEntry);
|
||||
}
|
||||
}
|
||||
} catch (CdtVariableException e) {
|
||||
|
@ -97,8 +99,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
|||
|
||||
}
|
||||
}
|
||||
if (! list.contains(entry)) {
|
||||
list.add(entry);
|
||||
if (!set.contains(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_10=Stop on first build error
|
||||
BuilderSettingsTab_EnableParallelBuild=Enable parallel build
|
||||
BuilderSettingsTab_UseOptimalJobs=Use number of processors ({0})
|
||||
BuilderSettingsTab_UseOptimalJobs=Use optimal jobs ({0})
|
||||
BuilderSettingsTab_UseParallelJobs=Use parallel jobs:
|
||||
BuilderSettingsTab_UseUnlimitedJobs=Use unlimited jobs
|
||||
BuilderSettingsTab_14=Workbench Build Behavior
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %fragmentName.aix
|
||||
Bundle-SymbolicName: org.eclipse.cdt.core.aix; singleton:=true
|
||||
Bundle-Version: 5.1.1.qualifier
|
||||
Bundle-Version: 5.3.0.qualifier
|
||||
Bundle-Vendor: %providerName
|
||||
Fragment-Host: org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)"
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,14 +7,21 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: hasPTY */
|
||||
/*
|
||||
* Class: org_eclipse_cdt_utils_pty_PTY
|
||||
* Method: openMaster
|
||||
* Signature: ()Ljava/lang/String;
|
||||
* Signature: (Z)Ljava/lang/String;
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
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
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
|
@ -16,7 +17,13 @@
|
|||
#include <errno.h>
|
||||
|
||||
extern pid_t exec0(const char *path, char *const argv[],
|
||||
char *const envp[], const char *dirpath,
|
||||
int channels[3] );
|
||||
char *const envp[], const char *dirpath,
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - initial API and implementation
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#include "exec0.h"
|
||||
|
@ -20,11 +21,11 @@
|
|||
#include <termios.h>
|
||||
|
||||
/* from pfind.c */
|
||||
extern char *pfind(const char *name);
|
||||
extern char *pfind(const char *name, char * const envp[]);
|
||||
|
||||
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)
|
||||
const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
|
||||
{
|
||||
int pipe2[2];
|
||||
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.
|
||||
* 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) {
|
||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||
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.
|
||||
*/
|
||||
if (channels != NULL) {
|
||||
if (channels != NULL && console) {
|
||||
if (pipe(pipe2) < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||
free(full_path);
|
||||
|
@ -64,6 +65,11 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
|||
if (channels != NULL) {
|
||||
int fds;
|
||||
|
||||
if (!console && setsid() < 0) {
|
||||
perror("setsid()");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fds = ptys_open(fdm, pts_name);
|
||||
if (fds < 0) {
|
||||
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 */
|
||||
if (close(pipe2[0]) == -1)
|
||||
if (console && close(pipe2[0]) == -1)
|
||||
perror("close(pipe2[0]))");
|
||||
|
||||
/* close the master, no need in the child */
|
||||
close(fdm);
|
||||
|
||||
set_noecho(fds);
|
||||
if (console) {
|
||||
set_noecho(fds);
|
||||
if (setpgid(getpid(), getpid()) < 0) {
|
||||
perror("setpgid()");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* redirections */
|
||||
dup2(fds, STDIN_FILENO); /* dup stdin */
|
||||
dup2(fds, STDOUT_FILENO); /* dup stdout */
|
||||
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
||||
if (console) {
|
||||
dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
|
||||
} else {
|
||||
dup2(fds, STDERR_FILENO); /* dup stderr */
|
||||
}
|
||||
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 */
|
||||
|
||||
set_noecho(fdm);
|
||||
if (console) {
|
||||
set_noecho(fdm);
|
||||
}
|
||||
if (channels != NULL) {
|
||||
/* close the write end of pipe1 */
|
||||
if (close(pipe2[1]) == -1)
|
||||
perror("close(pipe2[1])");
|
||||
|
||||
channels[0] = fdm; /* Input Stream. */
|
||||
channels[1] = fdm; /* Output Stream. */
|
||||
channels[2] = pipe2[0]; /* stderr Stream. */
|
||||
/*channels[2] = fdm; Input Stream. */
|
||||
if (console) {
|
||||
/* close the write end of pipe1 */
|
||||
if (close(pipe2[1]) == -1)
|
||||
perror("close(pipe2[1])");
|
||||
channels[2] = pipe2[0]; /* stderr Stream. */
|
||||
} else {
|
||||
channels[2] = fdm; /* Error Stream. */
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#include "exec0.h"
|
||||
|
@ -19,7 +20,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
/* from pfind.c */
|
||||
extern char *pfind(const char *name);
|
||||
extern char *pfind(const char *name, char * const envp[]);
|
||||
|
||||
pid_t
|
||||
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.
|
||||
* 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) {
|
||||
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
|
||||
return -1;
|
||||
|
@ -91,6 +92,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
|||
close(fd++);
|
||||
}
|
||||
|
||||
setpgid(getpid(), getpid());
|
||||
|
||||
if (envp[0] == NULL) {
|
||||
execv(full_path, argv);
|
||||
} else {
|
||||
|
@ -135,9 +138,19 @@ int wait0(pid_t pid)
|
|||
int status;
|
||||
int val = -1;
|
||||
|
||||
if (pid < 0 || waitpid(pid, &status, 0) < 0)
|
||||
if (pid < 0)
|
||||
return -1;
|
||||
|
||||
for (;;) {
|
||||
if (waitpid(pid, &status, 0) < 0) {
|
||||
if (errno == EINTR) {
|
||||
// interrupted system call - retry
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (WIFEXITED(status)) {
|
||||
val = WEXITSTATUS(status);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,11 +8,12 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QNX Software Systems
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _OPENPTY_H
|
||||
#define _OPENPTY_H
|
||||
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);
|
||||
#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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -23,8 +24,25 @@
|
|||
#define PATH_MAX 1024
|
||||
#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" );
|
||||
|
||||
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 * pfind(const char *name, char * const envp[])
|
||||
{
|
||||
char *tok;
|
||||
char *sp;
|
||||
|
@ -46,7 +64,7 @@ char * pfind(const char *name)
|
|||
}
|
||||
|
||||
/* Search in the PATH environment. */
|
||||
path = getenv("PATH" );
|
||||
path = path_val( envp );
|
||||
|
||||
if (path == NULL || strlen(path) <= 0) {
|
||||
fprintf(stderr, "Unable to get $PATH.\n");
|
||||
|
@ -79,7 +97,7 @@ int main(int argc, char **argv)
|
|||
char *fullpath;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
fullpath = pfind(argv[i]);
|
||||
fullpath = pfind(argv[i], NULL);
|
||||
if (fullpath == NULL)
|
||||
printf("Unable to find %s in $PATH.\n", argv[i]);
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,8 +8,9 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QNX Software Systems
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include "PTY.h"
|
||||
#include "openpty.h"
|
||||
|
||||
|
@ -19,7 +20,7 @@
|
|||
* Signature: ()I
|
||||
*/
|
||||
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 */
|
||||
jstring jstr = NULL;
|
||||
int master = -1;
|
||||
|
@ -30,8 +31,10 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
|||
|
||||
master = ptym_open(line);
|
||||
if (master >= 0) {
|
||||
/* turn off echo */
|
||||
set_noecho(master);
|
||||
// turn off echo
|
||||
if (console) {
|
||||
set_noecho(master);
|
||||
}
|
||||
|
||||
/* Get a reference to the obj's class */
|
||||
cls = (*env)->GetObjectClass(env, jobj);
|
||||
|
@ -48,3 +51,22 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj) {
|
|||
}
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QNX Software Systems
|
||||
* IBM Corporation - port of 248071
|
||||
*******************************************************************************/
|
||||
|
||||
#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
|
||||
(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);
|
||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
|
||||
char **cmd;
|
||||
char **envp;
|
||||
char **cmd = NULL;
|
||||
char **envp = NULL;
|
||||
int fd[3];
|
||||
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);
|
||||
#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)
|
||||
goto bail_out;
|
||||
|
||||
|
@ -147,8 +148,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
|
|||
jstring jdir)
|
||||
{
|
||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||
char **cmd;
|
||||
char **envp;
|
||||
char **cmd = NULL;
|
||||
char **envp = NULL;
|
||||
pid_t pid = -1;
|
||||
|
||||
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);
|
||||
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
|
||||
char **cmd;
|
||||
char **envp;
|
||||
char **cmd = NULL;
|
||||
char **envp = NULL;
|
||||
int fd[3];
|
||||
pid_t pid = -1;
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>5.1.1-SNAPSHOT</version>
|
||||
<version>5.3.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.core.aix</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
* 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:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.scanner;
|
||||
|
||||
|
@ -201,7 +202,29 @@ public class LexerTests extends BaseTestCase {
|
|||
id("ab");
|
||||
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 {
|
||||
init("\n\n");
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,9 +8,12 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Chris Recoskie (IBM Corporation)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
@ -133,6 +136,11 @@ public abstract class FileContent {
|
|||
public static FileContent adapt(CodeReader reader) {
|
||||
if (reader == 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,13 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
* 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:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Mike Kucera (IBM) - UTF string literals
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Mike Kucera (IBM) - UTF string literals
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -195,7 +196,7 @@ final public class Lexer implements ITokenSequence {
|
|||
Token t= fToken;
|
||||
Token lt= null;
|
||||
while (true) {
|
||||
switch(t.getType()) {
|
||||
switch (t.getType()) {
|
||||
case IToken.tCOMPLETION:
|
||||
if (lt != null) {
|
||||
fLastToken= lt;
|
||||
|
@ -228,7 +229,7 @@ final public class Lexer implements ITokenSequence {
|
|||
public Token nextDirective() throws OffsetLimitReachedException {
|
||||
Token t0;
|
||||
Token t1= fToken;
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
t0= t1;
|
||||
t1= fetchToken();
|
||||
final int tt1 = t1.getType();
|
||||
|
@ -252,7 +253,7 @@ final public class Lexer implements ITokenSequence {
|
|||
final int start= fOffset;
|
||||
final int c= fCharPhase3;
|
||||
final int d= nextCharPhase3();
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case END_OF_INPUT:
|
||||
return newToken(IToken.tEND_OF_INPUT, start);
|
||||
case '\n':
|
||||
|
@ -266,7 +267,7 @@ final public class Lexer implements ITokenSequence {
|
|||
continue;
|
||||
|
||||
case 'L':
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case 'R':
|
||||
if (fOptions.fSupportRawStringLiterals) {
|
||||
markPhase3();
|
||||
|
@ -289,7 +290,7 @@ final public class Lexer implements ITokenSequence {
|
|||
case 'u':
|
||||
case 'U':
|
||||
if (fOptions.fSupportUTFLiterals) {
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case 'R':
|
||||
if (fOptions.fSupportRawStringLiterals) {
|
||||
markPhase3();
|
||||
|
@ -364,7 +365,7 @@ final public class Lexer implements ITokenSequence {
|
|||
break;
|
||||
|
||||
case '\\':
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case 'u': case 'U':
|
||||
nextCharPhase3();
|
||||
return identifier(start, 2);
|
||||
|
@ -376,7 +377,7 @@ final public class Lexer implements ITokenSequence {
|
|||
return number(start, 1, false);
|
||||
|
||||
case '.':
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
nextCharPhase3();
|
||||
|
@ -420,7 +421,7 @@ final public class Lexer implements ITokenSequence {
|
|||
return newToken(IToken.tSEMI, start);
|
||||
|
||||
case ':':
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case ':':
|
||||
nextCharPhase3();
|
||||
return newToken(IToken.tCOLONCOLON, start);
|
||||
|
@ -564,7 +565,7 @@ final public class Lexer implements ITokenSequence {
|
|||
return headerName(start, false);
|
||||
}
|
||||
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case '=':
|
||||
nextCharPhase3();
|
||||
return newToken(IToken.tLTEQUAL, start);
|
||||
|
@ -582,8 +583,19 @@ final public class Lexer implements ITokenSequence {
|
|||
}
|
||||
break;
|
||||
case ':':
|
||||
nextCharPhase3();
|
||||
return newDigraphToken(IToken.tLBRACKET, start);
|
||||
// 2.5-3
|
||||
markPhase3();
|
||||
if (nextCharPhase3() != ':') {
|
||||
return newDigraphToken(IToken.tLBRACKET, start);
|
||||
}
|
||||
switch (nextCharPhase3()) {
|
||||
case ':': case '>':
|
||||
restorePhase3();
|
||||
nextCharPhase3();
|
||||
return newDigraphToken(IToken.tLBRACKET, start);
|
||||
}
|
||||
restorePhase3();
|
||||
break;
|
||||
case '%':
|
||||
nextCharPhase3();
|
||||
return newDigraphToken(IToken.tLBRACE, start);
|
||||
|
@ -591,7 +603,7 @@ final public class Lexer implements ITokenSequence {
|
|||
return newToken(IToken.tLT, start);
|
||||
|
||||
case '>':
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case '=':
|
||||
nextCharPhase3();
|
||||
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) {
|
||||
final int endOffset= fOffset;
|
||||
final int sourceLen= endOffset-offset;
|
||||
final int sourceLen= endOffset - offset;
|
||||
char[] image;
|
||||
if (sourceLen != imageLength) {
|
||||
image= getCharImage(offset, endOffset, imageLength);
|
||||
|
@ -719,7 +731,7 @@ final public class Lexer implements ITokenSequence {
|
|||
int c= fCharPhase3;
|
||||
|
||||
loop: while (!done) {
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case END_OF_INPUT:
|
||||
if (fSupportContentAssist) {
|
||||
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
||||
|
@ -752,19 +764,19 @@ final public class Lexer implements ITokenSequence {
|
|||
final int delimOffset= fOffset;
|
||||
int delimEndOffset = delimOffset;
|
||||
int offset;
|
||||
for(;; delimEndOffset++) {
|
||||
for (;; delimEndOffset++) {
|
||||
if (!fInput.isValidOffset(delimEndOffset)) {
|
||||
offset= delimEndOffset;
|
||||
break;
|
||||
}
|
||||
if (fInput.get(delimEndOffset) == '(') {
|
||||
offset= delimEndOffset+1;
|
||||
offset= delimEndOffset + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final int delimLength= delimEndOffset-delimOffset;
|
||||
for(;; offset++) {
|
||||
final int delimLength= delimEndOffset - delimOffset;
|
||||
for (;; offset++) {
|
||||
if (!fInput.isValidOffset(offset)) {
|
||||
handleProblem(IProblem.SCANNER_UNBOUNDED_STRING, getInputChars(start, offset), start);
|
||||
break;
|
||||
|
@ -772,27 +784,27 @@ final public class Lexer implements ITokenSequence {
|
|||
|
||||
final char c= fInput.get(offset);
|
||||
if (c == ')') {
|
||||
final int endingDoubleQuoteOffset= offset+delimLength+1;
|
||||
final int endingDoubleQuoteOffset= offset + delimLength + 1;
|
||||
if (fInput.isValidOffset(endingDoubleQuoteOffset) && fInput.get(endingDoubleQuoteOffset) == '"') {
|
||||
boolean prefixMatches= true;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prefixMatches) {
|
||||
offset= endingDoubleQuoteOffset+1;
|
||||
offset= endingDoubleQuoteOffset + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fOffset= offset-1;
|
||||
fOffset= offset - 1;
|
||||
fEndOffset= offset;
|
||||
fCharPhase3= 0;
|
||||
nextCharPhase3();
|
||||
return newToken(tokenType, start, offset-start);
|
||||
return newToken(tokenType, start, offset - start);
|
||||
}
|
||||
|
||||
private Token charLiteral(final int start, final int tokenType) throws OffsetLimitReachedException {
|
||||
|
@ -802,7 +814,7 @@ final public class Lexer implements ITokenSequence {
|
|||
int c= fCharPhase3;
|
||||
|
||||
loop: while (!done) {
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case END_OF_INPUT:
|
||||
if (fSupportContentAssist) {
|
||||
throw new OffsetLimitReachedException(ORIGIN_LEXER, newToken(tokenType, start, length));
|
||||
|
@ -835,7 +847,7 @@ final public class Lexer implements ITokenSequence {
|
|||
boolean isPartOfIdentifier= true;
|
||||
int c= fCharPhase3;
|
||||
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 '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':
|
||||
|
@ -849,7 +861,7 @@ final public class Lexer implements ITokenSequence {
|
|||
|
||||
case '\\': // universal character name
|
||||
markPhase3();
|
||||
switch(nextCharPhase3()) {
|
||||
switch (nextCharPhase3()) {
|
||||
case 'u': case 'U':
|
||||
length++;
|
||||
break;
|
||||
|
@ -904,7 +916,7 @@ final public class Lexer implements ITokenSequence {
|
|||
boolean isHex= false;
|
||||
int c= fCharPhase3;
|
||||
while (true) {
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
// non-digit
|
||||
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':
|
||||
|
@ -952,7 +964,7 @@ final public class Lexer implements ITokenSequence {
|
|||
// universal character name (non-digit)
|
||||
case '\\':
|
||||
markPhase3();
|
||||
switch(nextCharPhase3()) {
|
||||
switch (nextCharPhase3()) {
|
||||
case 'u': case 'U':
|
||||
length++;
|
||||
break;
|
||||
|
@ -1013,7 +1025,7 @@ final public class Lexer implements ITokenSequence {
|
|||
private int nextCharPhase3() {
|
||||
int pos= fEndOffset;
|
||||
do {
|
||||
if (!isValidOffset(pos+1)) {
|
||||
if (!isValidOffset(pos + 1)) {
|
||||
if (!isValidOffset(pos)) {
|
||||
fOffset= pos;
|
||||
fEndOffset= pos;
|
||||
|
@ -1021,7 +1033,7 @@ final public class Lexer implements ITokenSequence {
|
|||
return END_OF_INPUT;
|
||||
}
|
||||
fOffset= pos;
|
||||
fEndOffset= pos+1;
|
||||
fEndOffset= pos + 1;
|
||||
fCharPhase3= fInput.get(pos);
|
||||
return fCharPhase3;
|
||||
}
|
||||
|
@ -1030,7 +1042,7 @@ final public class Lexer implements ITokenSequence {
|
|||
fOffset= pos;
|
||||
fEndOffset= ++pos;
|
||||
fCharPhase3= c;
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
// windows line-ending
|
||||
case '\r':
|
||||
if (fInput.get(pos) == '\n') {
|
||||
|
@ -1080,7 +1092,7 @@ final public class Lexer implements ITokenSequence {
|
|||
* @return the character encoded or 0.
|
||||
*/
|
||||
private char checkTrigraph(char c) {
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case '=': return '#';
|
||||
case '\'':return '^';
|
||||
case '(': return '[';
|
||||
|
@ -1101,7 +1113,7 @@ final public class Lexer implements ITokenSequence {
|
|||
boolean haveBackslash= true;
|
||||
int result= -1;
|
||||
loop: while (isValidOffset(pos)) {
|
||||
switch(fInput.get(pos++)) {
|
||||
switch (fInput.get(pos++)) {
|
||||
case '\n':
|
||||
if (haveBackslash) {
|
||||
result= pos;
|
||||
|
@ -1140,7 +1152,7 @@ final public class Lexer implements ITokenSequence {
|
|||
* Returns the image from the input without any modification.
|
||||
*/
|
||||
public char[] getInputChars(int offset, int endOffset) {
|
||||
final int length= endOffset-offset;
|
||||
final int length= endOffset - offset;
|
||||
if (length <= 0) {
|
||||
return CharArrayUtils.EMPTY;
|
||||
}
|
||||
|
@ -1160,7 +1172,7 @@ final public class Lexer implements ITokenSequence {
|
|||
final char[] result= new char[imageLength];
|
||||
markPhase3();
|
||||
fEndOffset= offset;
|
||||
for (int idx=0; idx<imageLength; idx++) {
|
||||
for (int idx= 0; idx < imageLength; idx++) {
|
||||
result[idx]= (char) nextCharPhase3();
|
||||
}
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -13,6 +13,7 @@
|
|||
* Tim Kelly (Nokia)
|
||||
* Anna Dushistova (MontaVista)
|
||||
* Marc-Andre Laperle
|
||||
* Martin Oberhuber (Wind River) - [397652] fix up-to-date check for PDOM
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
|
@ -23,6 +24,7 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
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.IStatus;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
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 com.ibm.icu.text.MessageFormat;
|
||||
import com.ibm.icu.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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$
|
||||
return true; // no check performed in this case
|
||||
return null; // No check is performed in this case
|
||||
|
||||
Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>();
|
||||
cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor()));
|
||||
IStatus syncStatus = null;
|
||||
|
||||
try {
|
||||
IIndex index= getIndex(cproject);
|
||||
|
@ -1543,8 +1561,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
IResource resource= tu.getResource();
|
||||
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
|
||||
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile) resource);
|
||||
if (!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
|
||||
return false;
|
||||
syncStatus = areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location);
|
||||
if (syncStatus != null) {
|
||||
return syncStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1555,11 +1574,11 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
CCorePlugin.log(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isSubjectToIndexing(ILanguage language) {
|
||||
final int linkageID=language.getLinkageID();
|
||||
final int linkageID = language.getLinkageID();
|
||||
for (int id : IDS_FOR_LINKAGES_TO_INDEX) {
|
||||
if (linkageID == id)
|
||||
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 index the index to check against
|
||||
* @param resource the resource to check from the workspace
|
||||
* @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
|
||||
*/
|
||||
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)) {
|
||||
trail.add(location);
|
||||
|
||||
IIndexFile[] file= index.getFiles(location);
|
||||
IIndexFile[] files= index.getFiles(location);
|
||||
|
||||
// pre-includes may be listed twice (191989)
|
||||
if (file.length < 1 || file.length > 2)
|
||||
return false;
|
||||
if (files.length <= 0)
|
||||
return new MultiStatus(CCorePlugin.PLUGIN_ID, IStatus.OK, "No index file found for: " + location, null); //$NON-NLS-1$
|
||||
|
||||
if (resource.getLocalTimeStamp() != file[0].getTimestamp())
|
||||
return false;
|
||||
for (IIndexFile file : files) {
|
||||
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
|
||||
// be read from the index.
|
||||
IIndexInclude[] includes= index.findIncludes(file[0]);
|
||||
for (IIndexInclude inc : includes) {
|
||||
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
||||
if (newLocation != null) {
|
||||
String path= newLocation.getFullPath();
|
||||
if (path != null) {
|
||||
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
||||
if (!areSynchronized(trail, index, newResource, newLocation)) {
|
||||
return false;
|
||||
// If it is up-to-date, the includes have not changed and may be read from the index.
|
||||
IIndexInclude[] includes= index.findIncludes(file);
|
||||
for (IIndexInclude inc : includes) {
|
||||
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
||||
if (newLocation != null) {
|
||||
String path= newLocation.getFullPath();
|
||||
if (path != null) {
|
||||
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
||||
MultiStatus m = areSynchronized(trail, index, newResource, newLocation);
|
||||
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) {
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,11 +8,11 @@
|
|||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* 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;
|
||||
|
||||
import java.io.File;
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
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.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* An ISafeRunnable which
|
||||
* <ul>
|
||||
|
@ -43,14 +46,28 @@ public class GeneratePDOM {
|
|||
protected File targetLocation;
|
||||
protected String indexerID;
|
||||
protected boolean deleteOnExit;
|
||||
|
||||
public GeneratePDOM(IExportProjectProvider pm, String[] applicationArguments, File targetLocation, String indexerID) {
|
||||
protected boolean checkIndexStatus;
|
||||
|
||||
/**
|
||||
* 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.applicationArguments= applicationArguments;
|
||||
this.targetLocation= targetLocation;
|
||||
this.indexerID= indexerID;
|
||||
this.checkIndexStatus= checkIndexStatus;
|
||||
}
|
||||
|
||||
|
||||
public GeneratePDOM(IExportProjectProvider pm, String[] applicationArguments, File targetLocation,
|
||||
String indexerID) {
|
||||
this(pm, applicationArguments, targetLocation, indexerID, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* When set, the project created by the associated {@link IExportProjectProvider} will
|
||||
* be deleted after {@link #run()} completes. By default this is not set.
|
||||
|
@ -66,74 +83,77 @@ public class GeneratePDOM {
|
|||
* @throws CoreException if an internal or invalid configuration error occurs
|
||||
*/
|
||||
public final IStatus run() throws CoreException {
|
||||
boolean isContentSynced= false;
|
||||
|
||||
// create the project
|
||||
// Create the project
|
||||
pm.setApplicationArguments(applicationArguments);
|
||||
final ICProject cproject = pm.createProject();
|
||||
if(cproject==null) {
|
||||
if (cproject == null) {
|
||||
fail(MessageFormat.format(Messages.GeneratePDOM_ProjectProviderReturnedNullCProject,
|
||||
new Object [] {pm.getClass().getName()}));
|
||||
return null; // cannot be reached, inform the compiler
|
||||
new Object[] { pm.getClass().getName() }));
|
||||
return null; // Cannot be reached, inform the compiler
|
||||
}
|
||||
|
||||
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
||||
if(converter==null) {
|
||||
if (converter == null) {
|
||||
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);
|
||||
|
||||
try {
|
||||
final IIndexManager im = CCorePlugin.getIndexManager();
|
||||
final IIndexManager manager = CCorePlugin.getIndexManager();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
if(CCoreInternals.getPDOMManager().isProjectRegistered(cproject)) {
|
||||
im.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
||||
if (!im.isIndexerSetupPostponed(cproject)) {
|
||||
if (CCoreInternals.getPDOMManager().isProjectRegistered(cproject)) {
|
||||
manager.joinIndexer(Integer.MAX_VALUE, new NullProgressMonitor());
|
||||
if (!manager.isIndexerSetupPostponed(cproject)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(200);
|
||||
}
|
||||
|
||||
// check status
|
||||
isContentSynced= CCoreInternals.getPDOMManager().isProjectContentSynced(cproject);
|
||||
|
||||
if(isContentSynced) {
|
||||
// export a .pdom file
|
||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
||||
|
||||
// write properties to exported PDOM
|
||||
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||
exportedPDOM.acquireWriteLock(0);
|
||||
try {
|
||||
Map<String,String> exportProperties= pm.getExportProperties();
|
||||
if(exportProperties!=null) {
|
||||
for(Map.Entry<String,String> entry : exportProperties.entrySet()) {
|
||||
exportedPDOM.setProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
exportedPDOM.close();
|
||||
}
|
||||
finally {
|
||||
exportedPDOM.releaseWriteLock();
|
||||
if (checkIndexStatus) {
|
||||
// Check status
|
||||
IStatus syncStatus = CCoreInternals.getPDOMManager().getProjectContentSyncState(cproject);
|
||||
if (syncStatus != null) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
} catch(InterruptedException ie) {
|
||||
// Export a .pdom file
|
||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, targetLocation, converter);
|
||||
|
||||
// Write properties to exported PDOM
|
||||
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter,
|
||||
LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||
exportedPDOM.acquireWriteLock(0);
|
||||
try {
|
||||
Map<String, String> exportProperties= pm.getExportProperties();
|
||||
if (exportProperties != null) {
|
||||
for(Map.Entry<String, String> entry : exportProperties.entrySet()) {
|
||||
exportedPDOM.setProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
exportedPDOM.close();
|
||||
} finally {
|
||||
exportedPDOM.releaseWriteLock();
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
String msg= MessageFormat.format(Messages.GeneratePDOM_GenericGenerationFailed, new Object[] {ie.getMessage()});
|
||||
throw new CoreException(CCorePlugin.createStatus(msg, ie));
|
||||
} finally {
|
||||
if(deleteOnExit) {
|
||||
if (deleteOnExit) {
|
||||
cproject.getProject().delete(true, new NullProgressMonitor());
|
||||
}
|
||||
}
|
||||
|
||||
return isContentSynced ?
|
||||
new Status(IStatus.OK, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Success)
|
||||
: new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Incomplete);
|
||||
return new Status(IStatus.OK, CCorePlugin.PLUGIN_ID, Messages.GeneratePDOM_Success);
|
||||
}
|
||||
|
||||
private void fail(String message) throws CoreException {
|
||||
|
|
|
@ -771,6 +771,16 @@
|
|||
</baseType>
|
||||
</complexArray>
|
||||
</processType>
|
||||
<processType
|
||||
name="AddNature"
|
||||
processRunner="org.eclipse.cdt.core.templateengine.process.processes.AddNature">
|
||||
<simple
|
||||
name="projectName">
|
||||
</simple>
|
||||
<simple
|
||||
name="natureId">
|
||||
</simple>
|
||||
</processType>
|
||||
</extension>
|
||||
<extension
|
||||
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.3=Copy failure: cannot read template source:
|
||||
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 {
|
||||
//typedef int MyType;
|
||||
//public:
|
||||
//int getA() {
|
||||
//virtual int getA() {
|
||||
//return a;
|
||||
//}
|
||||
//MyClass();
|
||||
|
@ -444,7 +444,7 @@ public class CIndenterTest extends BaseUITestCase {
|
|||
//class MyClass {
|
||||
// typedef int MyType;
|
||||
// public:
|
||||
// int getA() {
|
||||
// virtual int getA() {
|
||||
// return a;
|
||||
// }
|
||||
// MyClass();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2011 IBM Corporation 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
|
||||
* Copyright (c) 2000, 2011 IBM Corporation 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:
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
|
@ -28,26 +28,21 @@ import org.eclipse.cdt.ui.text.ICPartitions;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Tests to verify the C partitioning.
|
||||
* Derived from JavaPartitionerTest.
|
||||
*/
|
||||
public class CPartitionerTest extends TestCase {
|
||||
|
||||
private CTextTools fTextTools;
|
||||
private Document fDocument;
|
||||
protected boolean fDocumentPartitioningChanged;
|
||||
|
||||
|
||||
public CPartitionerTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
|
||||
fTextTools= new CTextTools();
|
||||
|
||||
fDocument= new Document();
|
||||
|
@ -84,7 +79,6 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
|
||||
protected void checkPartitioning(ITypedRegion[] expectation, ITypedRegion[] result) {
|
||||
|
||||
assertEquals("invalid number of partitions", expectation.length, result.length);
|
||||
|
||||
for (int i= 0; i < expectation.length; i++) {
|
||||
|
@ -92,12 +86,10 @@ public class CPartitionerTest extends TestCase {
|
|||
ITypedRegion r= result[i];
|
||||
assertTrue(print(r) + " != " + print(e), r.equals(e));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testInitialPartitioning() {
|
||||
try {
|
||||
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
@ -121,7 +113,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testIntraPartitionChange() {
|
||||
try {
|
||||
|
||||
fDocument.replace(34, 3, "y");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\ny\n/***/\nxxx");
|
||||
|
||||
|
@ -148,7 +139,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testIntraPartitionChange2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(41, 0, "yyy");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/**yyy*/\nxxx");
|
||||
|
||||
|
@ -172,9 +162,9 @@ public class CPartitionerTest extends TestCase {
|
|||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void testInsertNewPartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(35, 1, "/***/");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx/***/x\n/***/\nxxx");
|
||||
|
||||
|
@ -200,9 +190,9 @@ public class CPartitionerTest extends TestCase {
|
|||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void testInsertStringPartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(35, 1, "\"yyy\"");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||
|
||||
|
@ -228,9 +218,9 @@ public class CPartitionerTest extends TestCase {
|
|||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void testInsertCharacterPartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(35, 1, "'y'");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx");
|
||||
|
||||
|
@ -256,9 +246,9 @@ public class CPartitionerTest extends TestCase {
|
|||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void testInsertPreprocessorPartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(4, 0, " # include <x.h>\n");
|
||||
// "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");
|
||||
|
@ -287,13 +277,11 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testRemovePartition1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(13, 16, null);
|
||||
// "xxx\n/*xxx*/\nx/**/\nxxx\n/***/\nxxx");
|
||||
|
||||
assertTrue(fDocumentPartitioningChanged);
|
||||
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
new TypedRegion(0, 4, IDocument.DEFAULT_CONTENT_TYPE),
|
||||
|
@ -312,12 +300,10 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testRemovePartition2() {
|
||||
|
||||
testJoinPartition3();
|
||||
fDocumentPartitioningChanged= false;
|
||||
|
||||
try {
|
||||
|
||||
fDocument.replace(5, 2, null);
|
||||
// "xxx\nxxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
||||
|
@ -340,10 +326,8 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void testJoinPartitions1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(31, 1, null);
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||
|
||||
|
@ -368,7 +352,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testJoinPartitions2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(32, 1, null);
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||
|
||||
|
@ -393,7 +376,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testJoinPartition3() {
|
||||
try {
|
||||
|
||||
fDocument.replace(9, 2, null);
|
||||
// "xxx\n/*xxx\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
||||
|
@ -416,22 +398,16 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void testSplitPartition1() {
|
||||
|
||||
testJoinPartitions1();
|
||||
fDocumentPartitioningChanged= false;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/*/\nxxx\n/***/\nxxx"
|
||||
fDocument.replace(31, 0, "*");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
||||
assertTrue(fDocumentPartitioningChanged);
|
||||
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -440,18 +416,15 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testSplitPartition2() {
|
||||
|
||||
testJoinPartitions2();
|
||||
fDocumentPartitioningChanged= false;
|
||||
|
||||
try {
|
||||
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**\nxxx\n/***/\nxxx"
|
||||
fDocument.replace(32, 0, "/");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
||||
assertTrue(fDocumentPartitioningChanged);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -460,11 +433,9 @@ public class CPartitionerTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testSplitPartition3() {
|
||||
|
||||
fDocumentPartitioningChanged= false;
|
||||
|
||||
try {
|
||||
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
fDocument.replace(12, 9, "");
|
||||
// "xxx\n/*xxx*/\nx*/\nxxx\n/**/\nxxx\n/***/\nxxx"
|
||||
|
@ -490,7 +461,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testCorruptPartitioning1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/");
|
||||
|
||||
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(15, 7, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||
};
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -521,7 +490,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testCorruptPartitioning2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/***/\n/***/");
|
||||
|
||||
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(23, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||
};
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -556,7 +523,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testCorruptPartitioning3() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/\n/**/");
|
||||
|
||||
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(18, 5, ICPartitions.C_MULTI_LINE_COMMENT)
|
||||
};
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -589,7 +554,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testOpenPartition1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(42, 1, null);
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***\nxxx"
|
||||
|
||||
|
@ -616,7 +580,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testOpenPartition2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(47, 0, "/*");
|
||||
// "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nxxx\n/***/\nxxx/*"
|
||||
|
||||
|
@ -646,7 +609,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testPartitionFinder() {
|
||||
try {
|
||||
|
||||
ITypedRegion[] partitioning= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
||||
for (int i= 0; i < partitioning.length; i++) {
|
||||
|
@ -656,7 +618,6 @@ public class CPartitionerTest extends TestCase {
|
|||
assertTrue(expected.equals(result));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -664,7 +625,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testExtendPartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/*");
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
@ -681,7 +641,6 @@ public class CPartitionerTest extends TestCase {
|
|||
};
|
||||
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -689,7 +648,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testTogglePartition() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "\t/*\n\tx\n\t/*/\n\ty\n//\t*/");
|
||||
|
||||
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)
|
||||
};
|
||||
checkPartitioning(expectation2, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -720,7 +677,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditing1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "");
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
@ -749,7 +705,6 @@ public class CPartitionerTest extends TestCase {
|
|||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -757,7 +712,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditing2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(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)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -802,7 +755,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditing3() {
|
||||
try {
|
||||
|
||||
fDocument.replace(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)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -839,7 +790,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingString() {
|
||||
try {
|
||||
|
||||
fDocument.replace(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)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -912,7 +861,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingCharacter() {
|
||||
try {
|
||||
|
||||
fDocument.replace(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)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -985,7 +932,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingPreprocessor() {
|
||||
try {
|
||||
|
||||
fDocument.replace(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)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1104,7 +1049,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testLineSplicing_Bug124113() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "// comment... \\\\\ncontinued");
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
@ -1136,7 +1080,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_CHARACTER)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1144,7 +1087,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testCommentInPreprocessorString() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "#define S \"http://www.foo.bar\"");
|
||||
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
|
@ -1160,7 +1102,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(0, fDocument.getLength(), ICPartitions.C_PREPROCESSOR)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1168,7 +1109,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testString1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "\"[string]\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1184,7 +1124,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(10, 9, ICPartitions.C_STRING)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1192,7 +1131,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testString2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "\"string\"RRRRRRRR\"string\"nostring");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1202,7 +1140,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(24, 8, IDocument.DEFAULT_CONTENT_TYPE)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1210,7 +1147,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testRawString1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "R\"(line 1\n/*line 2*/\nline 3\n)\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1235,7 +1171,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(1, fDocument.getLength() - 1, ICPartitions.C_STRING)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1243,7 +1178,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testRawString2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1261,7 +1195,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(13, fDocument.getLength() - 13, ICPartitions.C_STRING)
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1269,7 +1202,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testRawString3() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1291,7 +1223,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1299,7 +1230,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testRawString_Bug352544() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "BAR\"(\";");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1308,7 +1238,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE),
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1316,7 +1245,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingRawString1() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1351,7 +1279,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(fDocument.getLength() - 5, 5, ICPartitions.C_STRING),
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1359,7 +1286,6 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingRawString2() {
|
||||
try {
|
||||
|
||||
fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\"");
|
||||
ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength());
|
||||
TypedRegion[] expectation= {
|
||||
|
@ -1402,7 +1328,6 @@ public class CPartitionerTest extends TestCase {
|
|||
new TypedRegion(6, fDocument.getLength() - 6, ICPartitions.C_STRING),
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
@ -1410,8 +1335,7 @@ public class CPartitionerTest extends TestCase {
|
|||
|
||||
public void testEditingRawString3() {
|
||||
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());
|
||||
TypedRegion[] expectation= {
|
||||
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),
|
||||
};
|
||||
checkPartitioning(expectation, result);
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
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.
|
||||
includeFolderDecorator.name = C/C++ Missing Include Folders
|
||||
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
|
||||
|
||||
|
|
|
@ -4156,6 +4156,22 @@
|
|||
</or>
|
||||
</enablement>
|
||||
</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>
|
||||
|
||||
<!-- Hyperlinking support -->
|
||||
|
|
|
@ -93,13 +93,12 @@ import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider;
|
|||
*
|
||||
* @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.
|
||||
*/
|
||||
public static class COutlineLabelProvider extends AppearanceAwareLabelProvider {
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
super(parent, flags);
|
||||
}
|
||||
/*
|
||||
* @see TreeViewer#internalExpandToLevel
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void internalExpandToLevel(Widget node, int level) {
|
||||
if (node instanceof Item) {
|
||||
|
@ -213,7 +210,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
public boolean isIncludesGroupingEnabled () {
|
||||
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +243,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
public boolean isMacroGroupingEnabled () {
|
||||
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,7 +252,6 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
* @since 3.0
|
||||
*/
|
||||
public class ToggleLinkingAction extends AbstractToggleLinkingAction {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
protected ITextEditor fEditor;
|
||||
protected ITranslationUnit fInput;
|
||||
|
@ -374,7 +370,7 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
int offset= tsel.getOffset();
|
||||
ICElement element= null;
|
||||
if (fEditor instanceof CEditor) {
|
||||
element= ((CEditor)fEditor).getElementAt(offset, false);
|
||||
element= ((CEditor) fEditor).getElementAt(offset, false);
|
||||
} else if (fInput != null) {
|
||||
try {
|
||||
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.
|
||||
*/
|
||||
public void synchronizeSelectionWithEditor() {
|
||||
if(fInput == null || fEditor == null || fTreeViewer == null)
|
||||
if (fInput == null || fEditor == null || fTreeViewer == null)
|
||||
return;
|
||||
|
||||
ITextSelection editorSelection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
|
||||
if(editorSelection == null)
|
||||
if (editorSelection == null)
|
||||
return;
|
||||
|
||||
int offset = editorSelection.getOffset();
|
||||
|
@ -513,7 +509,8 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
site.setSelectionProvider(fTreeViewer);
|
||||
|
||||
IActionBars bars= site.getActionBars();
|
||||
bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation);
|
||||
bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY,
|
||||
fTogglePresentation);
|
||||
|
||||
fSelectionSearchGroup = createSearchActionGroup();
|
||||
fOpenViewActionGroup = createOpenViewActionGroup();
|
||||
|
@ -786,5 +783,4 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
|
|||
};
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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.addSelectionChangedListener(this);
|
||||
}
|
||||
setOutlinePageInput(fOutlinePage, getEditorInput());
|
||||
setOutlinePageInputIfNotSame(fOutlinePage, getEditorInput());
|
||||
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.
|
||||
* @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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Martin Oberhuber (Wind River) - bug 398195: consider external API in IB
|
||||
*******************************************************************************/
|
||||
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.index.IIndex;
|
||||
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.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
|
@ -214,7 +216,8 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
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();
|
||||
try {
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - bug 398195: consider external API in IB
|
||||
*******************************************************************************/
|
||||
|
||||
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.IIndexFileLocation;
|
||||
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.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -70,7 +72,8 @@ public class IncludeBrowserUI {
|
|||
private static ITranslationUnit findTargetTranslationUnit(IInclude input) throws CoreException, InterruptedException {
|
||||
ICProject project= input.getCProject();
|
||||
if (project != null) {
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(project);
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(project,
|
||||
IIndexManager.ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
* Anton Leherbauer (Wind River Systems
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.preferences;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -81,7 +80,6 @@ import org.eclipse.cdt.internal.ui.text.util.CColorManager;
|
|||
* @since 4.0
|
||||
*/
|
||||
class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||
|
||||
/**
|
||||
* Item in the highlighting color list.
|
||||
*/
|
||||
|
@ -161,7 +159,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
}
|
||||
|
||||
private static class SemanticHighlightingColorListItem extends HighlightingColorListItem {
|
||||
|
||||
/** Enablement preference key */
|
||||
private final String fEnableKey;
|
||||
|
||||
|
@ -175,7 +172,8 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
* @param underlineKey the underlineKey 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);
|
||||
fEnableKey= enableKey;
|
||||
}
|
||||
|
@ -192,9 +190,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
* Color list label provider.
|
||||
*/
|
||||
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof String)
|
||||
|
@ -202,17 +197,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
return ((HighlightingColorListItem)element).getDisplayName();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getBackground(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
if (element instanceof SemanticHighlightingColorListItem) {
|
||||
|
@ -228,25 +217,15 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
* Color list content provider.
|
||||
*/
|
||||
private class ColorListContentProvider implements ITreeContentProvider {
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
@ -564,7 +543,6 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
}
|
||||
|
||||
private Control createSyntaxPage(final Composite parent) {
|
||||
|
||||
Composite colorComposite= new Composite(parent, SWT.NONE);
|
||||
GridLayout layout= new GridLayout();
|
||||
layout.marginHeight= 0;
|
||||
|
@ -912,11 +890,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
{ createHighlightedRange(13, 16, 4, SemanticHighlightings.ENUMERATOR) },
|
||||
{ createHighlightedRange(13, 22, 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(16, 10, 6, SemanticHighlightings.ENUM) },
|
||||
{ createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(15, 17, 7, SemanticHighlightings.METHOD) },
|
||||
{ createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(16, 7, 6, SemanticHighlightings.METHOD) },
|
||||
{ createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(16, 17, 7, SemanticHighlightings.METHOD) },
|
||||
{ createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(17, 7, 6, SemanticHighlightings.METHOD) },
|
||||
{ createHighlightedRange(17, 14, 6, SemanticHighlightings.ENUM) },
|
||||
{ createHighlightedRange(17, 21, 1, SemanticHighlightings.PARAMETER_VARIABLE) },
|
||||
{ createHighlightedRange(18, 8, 5, SemanticHighlightings.LOCAL_VARIABLE_DECLARATION) },
|
||||
|
@ -925,9 +903,9 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
|||
{ createHighlightedRange(19, 7, 6, SemanticHighlightings.FUNCTION) },
|
||||
{ createHighlightedRange(19, 14, 5, SemanticHighlightings.LOCAL_VARIABLE) },
|
||||
{ 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(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
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.preferences;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -19,8 +18,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Code coloring preference page.
|
||||
* <p>
|
||||
|
@ -30,41 +27,27 @@ import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
|||
* @since 4.0
|
||||
*/
|
||||
public class CEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage {
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHelpId() {
|
||||
return ICHelpContextIds.C_EDITOR_COLORS_PREF_PAGE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
|
||||
*/
|
||||
@Override
|
||||
protected void setDescription() {
|
||||
String description= PreferencesMessages.CEditorPreferencePage_colors;
|
||||
setDescription(description);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Label createDescriptionLabel(Composite parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
|
||||
*/
|
||||
@Override
|
||||
protected void setPreferenceStore() {
|
||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
|
||||
*/
|
||||
@Override
|
||||
protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
|
||||
return new CEditorColoringConfigurationBlock(overlayPreferenceStore);
|
||||
|
|
|
@ -1409,8 +1409,17 @@ public final class CIndenter {
|
|||
case Symbols.TokenPRIVATE:
|
||||
case Symbols.TokenPROTECTED:
|
||||
case Symbols.TokenPUBLIC:
|
||||
case Symbols.TokenVIRTUAL:
|
||||
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;
|
||||
if (!isConditional())
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
|
|||
* @since 4.0
|
||||
*/
|
||||
public class CPreprocessorScanner extends AbstractCScanner {
|
||||
|
||||
/** Properties for tokens. */
|
||||
private static String[] fgTokenProperties= {
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,10 +10,10 @@
|
|||
* QNX Software System
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.text;
|
||||
|
||||
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
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.doctools.IDocCommentOwner;
|
||||
|
||||
|
||||
/**
|
||||
* This scanner recognizes the C multi line comments, C single line comments,
|
||||
* C strings, C characters and C preprocessor directives.
|
||||
*/
|
||||
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
||||
|
||||
// states
|
||||
private static final int CCODE= 0;
|
||||
private static final int SINGLE_LINE_COMMENT= 1;
|
||||
|
@ -115,7 +113,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
*/
|
||||
@Override
|
||||
public IToken nextToken() {
|
||||
|
||||
fTokenOffset += fTokenLength;
|
||||
fTokenLength= fPrefixLength;
|
||||
|
||||
|
@ -135,7 +132,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
fLast= NONE; // ignore last
|
||||
if (fTokenLength > 0) {
|
||||
return preFix(fState, CCODE, NONE, 0);
|
||||
|
||||
} else {
|
||||
fPrefixLength= 0;
|
||||
return Token.EOF;
|
||||
|
@ -165,7 +161,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
|
||||
fState= CCODE;
|
||||
return token;
|
||||
|
||||
} else {
|
||||
consume();
|
||||
continue;
|
||||
|
@ -220,7 +215,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
case STRING:
|
||||
case PREPROCESSOR:
|
||||
case PREPROCESSOR_STRING:
|
||||
|
||||
int last;
|
||||
int newState;
|
||||
switch (ch) {
|
||||
|
@ -304,7 +298,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
fTokenLength++;
|
||||
fLast= SLASH;
|
||||
|
@ -321,7 +314,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
fTokenLength= fPrefixLength;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
consume();
|
||||
break;
|
||||
|
@ -527,14 +519,25 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
case RAW_STRING:
|
||||
switch (rawStringState) {
|
||||
case OPEN_DELIMITER:
|
||||
if (ch == '(') {
|
||||
switch (ch) {
|
||||
case '(':
|
||||
rawStringState = RawStringState.CONTENT;
|
||||
} else if (ch == '"') {
|
||||
return postFix(RAW_STRING);
|
||||
} else if (ch != ' ' && ch != '\\' && ch != ')' && fRawStringDelimiter.length() < 12) {
|
||||
fRawStringDelimiter.append((char) ch);
|
||||
} else {
|
||||
break;
|
||||
case ' ':
|
||||
case '\\':
|
||||
case ')':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f':
|
||||
case 11: // Vertical tab
|
||||
fState = STRING;
|
||||
break;
|
||||
default:
|
||||
if (fRawStringDelimiter.length() < 12) {
|
||||
fRawStringDelimiter.append((char) ch);
|
||||
} else {
|
||||
fState = STRING;
|
||||
}
|
||||
}
|
||||
consume();
|
||||
break;
|
||||
|
@ -603,7 +606,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
case BACKSLASH_CR:
|
||||
case BACKSLASH_BACKSLASH:
|
||||
return 2;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -624,7 +626,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
return fTokens[interceptTokenState(state)];
|
||||
}
|
||||
|
||||
|
||||
private final IToken preFix(int state, int newState, int last, int prefixLength) {
|
||||
fTokenLength -= getLastLength(fLast);
|
||||
fLast= last;
|
||||
|
@ -634,33 +635,25 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
|
||||
private static int getState(String contentType) {
|
||||
|
||||
if (contentType == null)
|
||||
if (contentType == null) {
|
||||
return CCODE;
|
||||
|
||||
else if (contentType.equals(C_SINGLE_LINE_COMMENT))
|
||||
} else if (contentType.equals(C_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;
|
||||
|
||||
else if (contentType.equals(C_STRING))
|
||||
} else if (contentType.equals(C_STRING)) {
|
||||
return STRING;
|
||||
|
||||
else if (contentType.equals(C_CHARACTER))
|
||||
} else if (contentType.equals(C_CHARACTER)) {
|
||||
return CHARACTER;
|
||||
|
||||
else if (contentType.equals(C_PREPROCESSOR))
|
||||
} else if (contentType.equals(C_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
|
||||
|
||||
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
|
||||
|
||||
else
|
||||
} else {
|
||||
return CCODE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -705,9 +698,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see ITokenScanner#setRange(IDocument, int, int)
|
||||
*/
|
||||
@Override
|
||||
public void setRange(IDocument document, int offset, int length) {
|
||||
fDocument= document;
|
||||
|
@ -743,15 +733,15 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
|
||||
private int interceptTokenState(int proposedTokenState) {
|
||||
if(fOwner!=null) {
|
||||
switch(proposedTokenState) {
|
||||
if (fOwner != null) {
|
||||
switch (proposedTokenState) {
|
||||
case MULTI_LINE_COMMENT:
|
||||
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||
if (fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||
return MULTI_LINE_DOC_COMMENT;
|
||||
break;
|
||||
|
||||
case SINGLE_LINE_COMMENT:
|
||||
if(fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||
if (fOwner.getSinglelineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||
return SINGLE_LINE_DOC_COMMENT;
|
||||
break;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
|||
* A slightly adapted FastPartitioner.
|
||||
*/
|
||||
public class FastCPartitioner extends FastPartitioner {
|
||||
|
||||
/**
|
||||
* Creates a new partitioner for the given content types.
|
||||
*
|
||||
|
@ -72,7 +71,7 @@ public class FastCPartitioner extends FastPartitioner {
|
|||
* @since 5.0
|
||||
*/
|
||||
public IDocCommentOwner getDocCommentOwner() {
|
||||
if(fScanner instanceof FastCPartitionScanner) {
|
||||
if (fScanner instanceof FastCPartitionScanner) {
|
||||
return ((FastCPartitionScanner)fScanner).getDocCommentOwner();
|
||||
}
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,10 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceStatus;
|
||||
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.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.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
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.CUIPlugin;
|
||||
|
||||
|
@ -98,7 +85,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
|
||||
private static final int ERRORTICK_WARNING= CElementImageDescriptor.WARNING;
|
||||
private static final int ERRORTICK_ERROR= CElementImageDescriptor.ERROR;
|
||||
private static final int TICK_CONFIGURATION = CElementImageDescriptor.SETTINGS;
|
||||
|
||||
private ImageDescriptorRegistry fRegistry;
|
||||
private boolean fUseNewRegistry= false;
|
||||
|
@ -114,15 +100,13 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
fUseNewRegistry= true;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 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
|
||||
* image registry.
|
||||
*/
|
||||
/**
|
||||
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
||||
*/
|
||||
public ProblemsLabelDecorator(ImageDescriptorRegistry registry) {
|
||||
fRegistry= registry;
|
||||
fProblemChangedListener= null;
|
||||
|
@ -136,17 +120,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ILabelDecorator#decorateText(String, Object)
|
||||
*/
|
||||
@Override
|
||||
public String decorateText(String text, Object element) {
|
||||
return text;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ILabelDecorator#decorateImage(Image, Object)
|
||||
*/
|
||||
@Override
|
||||
public Image decorateImage(Image image, Object obj) {
|
||||
int adornmentFlags= computeAdornmentFlags(obj);
|
||||
|
@ -169,9 +147,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
switch (type) {
|
||||
case ICElement.C_PROJECT:
|
||||
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:
|
||||
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_CLASS:
|
||||
case ICElement.C_UNION:
|
||||
|
@ -185,14 +163,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
break;
|
||||
}
|
||||
} 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) {
|
||||
if (e instanceof CModelException) {
|
||||
// if (((CModelException) e).isDoesNotExist()) {
|
||||
// return 0;
|
||||
// }
|
||||
}
|
||||
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -240,42 +213,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
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
|
||||
* 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;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IBaseLabelProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (fProblemChangedListener != null) {
|
||||
|
@ -314,17 +248,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IBaseLabelProvider#isLabelProperty(Object, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
|
||||
*/
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
if (fListeners == null) {
|
||||
|
@ -342,9 +270,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
|
||||
*/
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener listener) {
|
||||
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
|
||||
public void decorate(Object element, IDecoration decoration) {
|
||||
int adornmentFlags= computeAdornmentFlags(element);
|
||||
|
||||
if ((adornmentFlags & TICK_CONFIGURATION) != 0) {
|
||||
decoration.addOverlay(CPluginImages.DESC_OVR_SETTING);
|
||||
adornmentFlags &= ~TICK_CONFIGURATION;
|
||||
}
|
||||
|
||||
if (adornmentFlags == ERRORTICK_ERROR) {
|
||||
decoration.addOverlay(CPluginImages.DESC_OVR_ERROR);
|
||||
} else if (adornmentFlags == ERRORTICK_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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CustomBuildSettingsDecorator;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -104,9 +105,13 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
|||
/** Flag to render the 'external file' adornment for translation units */
|
||||
public static final int EXTERNAL_FILE = 0x40000;
|
||||
|
||||
/** Flag to render the 'custom settings' adornment
|
||||
* @since 5.2 */
|
||||
public final static int SETTINGS= 0x80000;
|
||||
/** Flag to render the 'custom settings' adornment. Do not use, this flag has been discontinued.
|
||||
* @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;
|
||||
|
||||
private ImageDescriptor fBaseImage;
|
||||
private int fFlags;
|
||||
|
@ -243,11 +248,6 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
|||
x -= data.width;
|
||||
drawImage(data, x, 0);
|
||||
}
|
||||
if ((fFlags & SETTINGS) != 0) {
|
||||
data = CPluginImages.DESC_OVR_SETTING.getImageData();
|
||||
x -= data.width;
|
||||
drawImage(data, x, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawBottomRight() {
|
||||
|
|
|
@ -128,17 +128,17 @@
|
|||
<!-- Adapters for contextual launch -->
|
||||
<extension point="org.eclipse.core.runtime.adapters">
|
||||
<factory
|
||||
class=""
|
||||
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||
adaptableType="org.eclipse.cdt.core.model.IBinary">
|
||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||
</factory>
|
||||
<factory
|
||||
class=""
|
||||
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||
adaptableType="org.eclipse.core.resources.IResource">
|
||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||
</factory>
|
||||
<factory
|
||||
class=""
|
||||
class="org.eclipse.cdt.debug.internal.ui.launch.InvalidLaunchableAdapterFactory"
|
||||
adaptableType="org.eclipse.cdt.core.model.ICProject">
|
||||
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
|
||||
</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.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
|
||||
# IBM Corporation
|
||||
###############################################################################
|
||||
output.tests.jar = bin/
|
||||
bin.includes = fragment.xml,\
|
||||
META-INF/,\
|
||||
.
|
||||
.,\
|
||||
data/,\
|
||||
about.html
|
||||
source.. = src/
|
||||
src.includes = about.html
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
src = $(wildcard *.cc *.c)
|
||||
destDir = ../bin
|
||||
GCCFLAGS = -gdwarf-2 -pthread -m32
|
||||
GCCFLAGS = -gdwarf-2 -pthread
|
||||
|
||||
all:
|
||||
@mkdir -p $(destDir)
|
||||
|
|
|
@ -21,8 +21,8 @@ unsigned int __stdcall PrintHello(void *threadid)
|
|||
void *PrintHello(void *threadid)
|
||||
#endif
|
||||
{
|
||||
int tid = (int)threadid;
|
||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
||||
long tid = (long)threadid;
|
||||
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
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
|
|
@ -14,9 +14,9 @@ typedef pthread_t TID;
|
|||
#endif
|
||||
|
||||
// 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)
|
||||
#endif
|
||||
{
|
||||
int tId = (int)threadId;
|
||||
long tId = (long)threadId;
|
||||
firstBreakpoint(tId); // Stop a first time
|
||||
|
||||
SLEEP(1); // Keep state running a little
|
||||
|
|
|
@ -73,8 +73,8 @@ unsigned int __stdcall testTracepoints(void *threadid)
|
|||
void *testTracepoints(void *threadid)
|
||||
#endif
|
||||
{
|
||||
int tid = (int)threadid;
|
||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
||||
long tid = (long)threadid;
|
||||
printf("Hello World! It's me, thread #%ld!\n", tid);
|
||||
|
||||
int lIntVar = 12345;
|
||||
double lDoubleVar = 12345.12345;
|
||||
|
|
|
@ -24,15 +24,53 @@
|
|||
</repository>
|
||||
</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>
|
||||
<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>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-surefire-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<useUIHarness>true</useUIHarness>
|
||||
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
|
||||
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M ${gdbPathOption}</argLine>
|
||||
<includes>
|
||||
<include>**/AutomatedSuite.*</include>
|
||||
</includes>
|
||||
|
|
|
@ -21,6 +21,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|||
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
||||
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.mi.service.command.events.IMIDMEvent;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||
|
@ -218,10 +220,10 @@ public class BaseTestCase {
|
|||
protected void doLaunch() throws Exception {
|
||||
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||
|
||||
System.out.println("====================================================================================================");
|
||||
System.out.println(String.format("Running test: %s using GDB: %s remote %s",
|
||||
testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "on" : "off"));
|
||||
System.out.println("====================================================================================================");
|
||||
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||
System.out.println(String.format("%s \"%s\" launching %s %s",
|
||||
GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : ""));
|
||||
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||
|
||||
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
||||
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||
|
@ -320,7 +322,7 @@ public class BaseTestCase {
|
|||
BufferedReader reader = new BufferedReader(r);
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(line + "\n");
|
||||
line = line.trim();
|
||||
if (line.startsWith("Listening on port")) {
|
||||
break;
|
||||
|
@ -351,8 +353,15 @@ public class BaseTestCase {
|
|||
public static void setGdbProgramNamesLaunchAttributes(String version) {
|
||||
// See bugzilla 303811 for why we have to append ".exe" on Windows
|
||||
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
|
||||
setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb." + version + (isWindows ? ".exe" : ""));
|
||||
setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, "gdbserver." + version + (isWindows ? ".exe" : ""));
|
||||
String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path");
|
||||
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() {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
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.runners.Suite;
|
||||
|
||||
|
@ -21,7 +21,7 @@ import org.junit.runners.Suite;
|
|||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
Suite_7_4.class,
|
||||
Suite_7_5.class,
|
||||
// Can't run the Remote test just yet because they
|
||||
// have the same names on the local tests, which is
|
||||
// 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.IRunControl.IContainerDMContext;
|
||||
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.MIBreakpoints;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||
|
@ -240,7 +241,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IBreakpointsAddedEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||
|
@ -251,7 +252,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IBreakpointsUpdatedEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||
|
@ -262,7 +263,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IBreakpointsRemovedEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||
|
@ -273,7 +274,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(MIBreakpointHitEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
fBreakpointRef = e.getNumber();
|
||||
|
@ -284,7 +285,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(MIWatchpointTriggerEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
fBreakpointRef = e.getNumber();
|
||||
|
@ -295,7 +296,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(MIWatchpointScopeEvent e) {
|
||||
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]++;
|
||||
fBreakpointEventCount++;
|
||||
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.IRunControl.IContainerDMContext;
|
||||
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.MIBreakpoints;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||
|
@ -225,7 +226,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
synchronized (fEventHandlerLock) {
|
||||
fBreakpointEvents[BP_ADDED]++;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +236,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
synchronized (fEventHandlerLock) {
|
||||
fBreakpointEvents[BP_UPDATED]++;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +246,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
synchronized (fEventHandlerLock) {
|
||||
fBreakpointEvents[BP_REMOVED]++;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
synchronized (fEventHandlerLock) {
|
||||
fBreakpointEvents[BP_HIT]++;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
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.IStack.IFrameDMContext;
|
||||
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.IMIProcesses;
|
||||
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.output.MIDataListRegisterNamesInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
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.SyncUtil;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -62,18 +62,40 @@ import org.junit.runner.RunWith;
|
|||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
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() {
|
||||
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","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;
|
||||
protected List<String> get_X86_REGS() throws Throwable {
|
||||
if (fRegisterNames == null) {
|
||||
// The tests must run on different machines, so the set of registers can change.
|
||||
// To deal with this we ask GDB for the list of registers.
|
||||
// Note that we send an MI Command in this code and do not use the IRegister service;
|
||||
// this is because we want to test the service later, comparing it to what we find
|
||||
// by asking GDB directly.
|
||||
Query<MIDataListRegisterNamesInfo> query = new Query<MIDataListRegisterNamesInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIDataListRegisterNamesInfo> rm) {
|
||||
IMICommandControl controlService = fServicesTracker.getService(IMICommandControl.class);
|
||||
controlService.queueCommand(
|
||||
controlService.getCommandFactory().createMIDataListRegisterNames(fContainerDmc), rm);
|
||||
}
|
||||
};
|
||||
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;
|
||||
|
||||
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.tests.ITestConstants;
|
||||
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;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
|
@ -26,23 +21,4 @@ public class MIRegistersTest_7_2 extends MIRegistersTest_7_1 {
|
|||
protected void setGdbVersion() {
|
||||
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)
|
||||
@Suite.SuiteClasses({
|
||||
// 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,
|
||||
MIRunControlTest_7_5.class,
|
||||
MIRunControlTargetAvailableTest_7_5.class,
|
||||
|
@ -45,7 +46,6 @@ import org.junit.runners.Suite;
|
|||
OperationsWhileTargetIsRunningNonStopTest_7_5.class,
|
||||
PostMortemCoreTest_7_5.class,
|
||||
CommandTimeoutTest_7_5.class,
|
||||
GDBMultiNonStopRunControlTest_7_5.class,
|
||||
Suite_Sessionless_Tests.class,
|
||||
GDBConsoleBreakpointsTest_7_5.class,
|
||||
/* Add your test class here */
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.junit.runners.Suite;
|
|||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
// 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,
|
||||
MIRegistersTest_7_6.class,
|
||||
MIRunControlTest_7_6.class,
|
||||
|
@ -45,7 +46,6 @@ import org.junit.runners.Suite;
|
|||
OperationsWhileTargetIsRunningTest_7_6.class,
|
||||
OperationsWhileTargetIsRunningNonStopTest_7_6.class,
|
||||
CommandTimeoutTest_7_6.class,
|
||||
GDBMultiNonStopRunControlTest_7_6.class,
|
||||
Suite_Sessionless_Tests.class,
|
||||
GDBConsoleBreakpointsTest_7_6.class,
|
||||
TraceFileTest_7_6.class,
|
||||
|
|
|
@ -994,7 +994,11 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
|||
CTabFolder tabFolder = fContextFolders.get(retrieval);
|
||||
if(tabFolder != null) {
|
||||
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 {
|
||||
tabFolder = createTabFolder(fRenderingsComposite);
|
||||
|
|
|
@ -7,17 +7,6 @@
|
|||
name="%extension.name.0"
|
||||
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
|
||||
name="%importer.name.1"
|
||||
id="org.eclipse.cdt.debug.ui.memory.transport.PlainTextImporter"
|
||||
|
@ -40,6 +29,17 @@
|
|||
class="org.eclipse.cdt.debug.ui.memory.transport.RAWBinaryExporter">
|
||||
</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 point="org.eclipse.ui.viewActions">
|
||||
|
|
|
@ -77,6 +77,13 @@
|
|||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="maxmemorysize" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Maximum size of the addressable memory this exporter can support in bits.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
@ -109,6 +116,13 @@
|
|||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="maxmemorysize" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Maximum size of the addressable memory this importer can support in bits.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
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.IDialogSettings;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -180,19 +181,46 @@ public class ExportMemoryDialog extends SelectionDialog
|
|||
registry.getExtensionPoint("org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"); //$NON-NLS-1$
|
||||
IConfigurationElement points[] =
|
||||
extensionPoint.getConfigurationElements();
|
||||
|
||||
|
||||
for (int i = 0; i < points.length; i++)
|
||||
{
|
||||
IConfigurationElement element = points[i];
|
||||
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
|
||||
{
|
||||
exporters.addElement((IMemoryExporter) element.createExecutableExtension("class")); //$NON-NLS-1$
|
||||
}
|
||||
catch(Exception e) {
|
||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
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.IMemoryRenderingContainer;
|
||||
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||
|
@ -219,6 +220,30 @@ public class ImportMemoryDialog extends SelectionDialog
|
|||
IConfigurationElement element = points[i];
|
||||
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
|
||||
{
|
||||
importers.addElement(element.createExecutableExtension("class")); //$NON-NLS-1$
|
||||
|
|
|
@ -96,7 +96,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -112,7 +112,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -128,7 +128,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -145,7 +145,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -159,11 +159,41 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
|
||||
textValue = fProperties.get(TRANSFER_START);
|
||||
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);
|
||||
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() {
|
||||
|
||||
|
@ -189,26 +219,38 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
|
||||
fStartText.addKeyListener(new KeyListener() {
|
||||
public void keyReleased(KeyEvent e) {
|
||||
boolean valid = true;
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -219,20 +261,34 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
getEndAddress();
|
||||
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 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 startAddress = getStartAddress();
|
||||
|
||||
String lengthString = endAddress.subtract(startAddress).toString();
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString))
|
||||
fLengthText.setText(lengthString);
|
||||
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)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
|
@ -246,22 +302,54 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public void keyReleased(KeyEvent e) {
|
||||
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));
|
||||
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
|
||||
BigInteger length = getLength();
|
||||
String endString;
|
||||
BigInteger startAddress = getStartAddress();
|
||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
||||
if(!fEndText.getText().equals(endString))
|
||||
fEndText.setText(endString);
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
|
@ -273,19 +361,33 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -296,6 +398,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -306,6 +409,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -325,7 +429,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -333,8 +436,19 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
isValid = false;
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -342,7 +456,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
}
|
||||
|
||||
fParentDialog.setValid(isValid);
|
||||
|
||||
}
|
||||
|
||||
public String getId()
|
||||
|
|
|
@ -113,7 +113,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
data = new FormData();
|
||||
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||
data.left = new FormAttachment(labelStartText);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -226,8 +226,9 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
try
|
||||
{
|
||||
getStartAddress();
|
||||
if(!getFile().exists())
|
||||
if(!getFile().exists()) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -245,6 +246,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -111,7 +111,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -127,7 +127,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -144,7 +144,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -158,11 +158,41 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
|
||||
textValue = fProperties.get(TRANSFER_START);
|
||||
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);
|
||||
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() {
|
||||
|
||||
|
@ -190,26 +220,38 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
|
||||
fStartText.addKeyListener(new KeyListener() {
|
||||
public void keyReleased(KeyEvent e) {
|
||||
boolean valid = true;
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -220,20 +262,34 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
getEndAddress();
|
||||
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 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 startAddress = getStartAddress();
|
||||
|
||||
String lengthString = endAddress.subtract(startAddress).toString();
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString))
|
||||
fLengthText.setText(lengthString);
|
||||
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)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
|
@ -247,22 +303,54 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
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));
|
||||
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
|
||||
BigInteger length = getLength();
|
||||
String endString;
|
||||
BigInteger startAddress = getStartAddress();
|
||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
||||
if(!fEndText.getText().equals(endString))
|
||||
fEndText.setText(endString);
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
|
@ -274,9 +362,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
});
|
||||
|
||||
composite.pack();
|
||||
|
@ -303,6 +389,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -313,6 +400,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -323,6 +411,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -342,7 +431,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -350,8 +438,19 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
isValid = false;
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -360,7 +459,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
|
||||
fParentDialog.setValid(isValid);
|
||||
}
|
||||
|
||||
|
||||
public String getId()
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
FormData data = new FormData();
|
||||
data.left = new FormAttachment(labelStartText);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -206,8 +206,9 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
try
|
||||
{
|
||||
getStartAddress();
|
||||
if(!getFile().exists())
|
||||
if(!getFile().exists()) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -225,6 +226,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -98,7 +98,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -114,7 +114,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -130,7 +130,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -147,7 +147,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -156,6 +156,24 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data.left = new FormAttachment(fFileText);
|
||||
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);
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
textValue = fProperties.get(TRANSFER_END);
|
||||
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||
|
||||
|
@ -186,7 +203,11 @@ public class SRecordExporter implements IMemoryExporter
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -225,21 +246,36 @@ public class SRecordExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
String lengthString = actualLength.toString();
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString)) {
|
||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
||||
fLengthText.setText(lengthString);
|
||||
}
|
||||
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));
|
||||
}
|
||||
validate();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
|
@ -249,24 +285,37 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
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 actualLength = getEndAddress().subtract(getStartAddress());
|
||||
String lengthString = actualLength.toString();
|
||||
fLengthText.setText(actualLength.toString());
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString)) {
|
||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
||||
fLengthText.setText(lengthString);
|
||||
}
|
||||
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
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)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
|
@ -277,21 +326,53 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
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));
|
||||
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
|
||||
if(!fEndText.getText().equals(endString)) {
|
||||
if ( ! length.equals( BigInteger.ZERO ) ) {
|
||||
fEndText.setText(endString);
|
||||
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
|
||||
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$
|
||||
}
|
||||
}
|
||||
validate();
|
||||
else {
|
||||
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
@ -333,6 +414,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -347,6 +429,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -361,6 +444,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -381,7 +465,6 @@ public class SRecordExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -389,8 +472,19 @@ public class SRecordExporter implements IMemoryExporter
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
isValid = false;
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -399,7 +493,6 @@ public class SRecordExporter implements IMemoryExporter
|
|||
|
||||
fParentDialog.setValid(isValid);
|
||||
}
|
||||
|
||||
|
||||
public String getId()
|
||||
{
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||
data.left = new FormAttachment(fComboRestoreToThisAddress);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
fComboRestoreToFileAddress.addSelectionListener(new SelectionListener() {
|
||||
|
@ -168,7 +168,7 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
data.top = new FormAttachment(fStartText);
|
||||
data.left = new FormAttachment(fFileText);
|
||||
fileButton.setLayoutData(data);
|
||||
|
||||
|
||||
String textValue = fProperties.get(TRANSFER_FILE);
|
||||
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||
|
||||
|
@ -247,6 +247,24 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||
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();
|
||||
parent.pack();
|
||||
|
||||
|
@ -294,6 +312,7 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -51,6 +51,7 @@ SRecordExporter.EndAddress=End address:
|
|||
SRecordExporter.Length=Length:
|
||||
SRecordExporter.Name=SRecord
|
||||
SRecordExporter.StartAddress=Start address:
|
||||
SRecordExporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||
|
||||
SRecordImporter.ChecksumFalure=Checksum failure of line =
|
||||
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.Name=SRecord
|
||||
SRecordImporter.ScrollToStart=Scroll to restore address
|
||||
SRecordImporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||
|
||||
RAWBinaryExporter.ChooseFile=Choose memory export file
|
||||
RAWBinaryExporter.EndAddress=End address:
|
||||
|
|
|
@ -6,6 +6,7 @@ Bundle-Version: 1.0.0.qualifier
|
|||
Bundle-Activator: org.eclipse.cdt.qt.core.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources;bundle-version="3.8.100",
|
||||
org.eclipse.cdt.core
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
|
|
@ -41,4 +41,13 @@
|
|||
priority="normal">
|
||||
</content-type>
|
||||
</extension>
|
||||
<extension
|
||||
id="qtNature"
|
||||
point="org.eclipse.core.resources.natures">
|
||||
<runtime>
|
||||
<run
|
||||
class="org.eclipse.cdt.qt.core.QtNature">
|
||||
</run>
|
||||
</runtime>
|
||||
</extension>
|
||||
</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
|
||||
height: 360
|
||||
Text {
|
||||
text: qsTr("Hello World")
|
||||
text: qsTr("Hello World from $(baseName)")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
|
|
|
@ -6,7 +6,7 @@ clean: clean-debug clean-release
|
|||
|
||||
build-debug/Makefile:
|
||||
@mkdir -p $(dir $@)
|
||||
$(QMAKE) -o $@ clangtest.pro CONFIG+=debug
|
||||
$(QMAKE) -o $@ {{baseName}}.pro CONFIG+=debug
|
||||
|
||||
debug: build-debug/Makefile
|
||||
$(MAKE) -w -C build-debug
|
||||
|
@ -16,7 +16,7 @@ clean-debug:
|
|||
|
||||
build-release/Makefile:
|
||||
@mkdir -p $(dir $@)
|
||||
$(QMAKE) -o $@ clangtest.pro CONFIG+=release
|
||||
$(QMAKE) -o $@ {{baseName}}.pro CONFIG+=release
|
||||
|
||||
release: build-release/Makefile
|
||||
$(MAKE) -w -C build-release
|
||||
|
|
|
@ -56,6 +56,10 @@
|
|||
</element>
|
||||
</complex-array>
|
||||
</process>
|
||||
|
||||
<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