From 9e6ee807a9eb89a255ac60ecfd513b5bba84fdfa Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Mon, 14 Jan 2013 06:23:04 -0500 Subject: [PATCH 01/29] Bug 378834 - Update Debug JUnit tests to run on Hudson Change-Id: Ie93ef3b2401b6823afd96504de1b5b5c577f1da4 Reviewed-on: https://git.eclipse.org/r/9656 Reviewed-by: Marc Khouzam IP-Clean: Marc Khouzam Tested-by: Marc Khouzam --- .../build.properties | 5 +- .../data/launch/src/Makefile | 2 +- .../data/launch/src/MultiThread.cc | 4 +- .../data/launch/src/MultiThreadRunControl.cc | 6 +-- .../data/launch/src/TracepointTestApp.cc | 4 +- dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml | 40 +++++++++++++++- .../tests/dsf/gdb/framework/BaseTestCase.java | 23 ++++++--- .../tests/dsf/gdb/tests/AutomatedSuite.java | 4 +- .../dsf/gdb/tests/MIBreakpointsTest.java | 15 +++--- .../dsf/gdb/tests/MICatchpointsTest.java | 11 +++-- .../tests/dsf/gdb/tests/MIRegistersTest.java | 48 ++++++++++++++----- .../tests/tests_7_2/MIRegistersTest_7_2.java | 24 ---------- 12 files changed, 117 insertions(+), 69 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties index 5d3e3b9ad20..90d7029058c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties @@ -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 diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile index 3ac4e9a2ff9..e67f6e886e9 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile @@ -1,6 +1,6 @@ src = $(wildcard *.cc *.c) destDir = ../bin -GCCFLAGS = -gdwarf-2 -pthread -m32 +GCCFLAGS = -gdwarf-2 -pthread all: @mkdir -p $(destDir) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc index e4d390d5a14..db0bd9ff5d1 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc @@ -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__ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc index f30714744ea..4556b07b6dd 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc @@ -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 diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc index 5bfe8649f95..ae8acdff923 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc @@ -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; diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml index 5423cfb4202..9b9554e9b4e 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml @@ -24,15 +24,53 @@ --> + + + production + + -Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb + + + + + + maven-antrun-plugin + + + clean + clean + + + + + + + run + + + + prepare + validate + + + + + + + run + + + + org.eclipse.tycho tycho-surefire-plugin ${tycho-version} true - -Xms256m -Xmx512m -XX:MaxPermSize=256M + -Xms256m -Xmx512m -XX:MaxPermSize=256M ${gdbPathOption} **/AutomatedSuite.* diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java index 8ba587e339c..9d0bffb8ccf 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java @@ -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() { diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java index b1dd875c211..64f7246de54 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java @@ -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) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java index 37dee117646..08fd209f524 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java @@ -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(); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java index b205d223238..f3e548d4440 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java @@ -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(); } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java index bffe6680735..770c169db83 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java @@ -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 fRegisterNames = null; - protected List get_X86_REGS() { - List list = new LinkedList(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 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 query = new Query() { + @Override + protected void execute(DataRequestMonitor 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(); + for (String name : names) { + if (!name.isEmpty()) { + fRegisterNames.add(name); + } + } + } + return fRegisterNames; } /* diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java index a7bcd4d7a8d..d2bac5c558c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java @@ -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 get_X86_REGS() { - List list = new LinkedList(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; - } - } From 111b6ba1852165dd558a23938e703e5fdd47dfb4 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber Date: Mon, 14 Jan 2013 12:36:51 -0800 Subject: [PATCH 02/29] Bug 397652 - Exporting a PDOM fails due to wrong index-in-sync check Fixes an incorrect workaround from bug 229989 comment 6: It is perfectly valid for one location to map to multiple index files. Also adds better error reporting for out-of-sync files, and adds API to allow exporting a PDOM without any index-in-sync check. Change-Id: I63a7d36a2de465f9994cc9b9698688e3ad6850ee --- .../cdt/internal/core/pdom/PDOMManager.java | 87 +++++++++----- .../core/pdom/export/GeneratePDOM.java | 110 +++++++++++------- 2 files changed, 124 insertions(+), 73 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index 0728d56c8ba..b111d0e90c3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -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 null 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 sources= new HashSet(); 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(), index, resource, location)) { - return false; + syncStatus = areSynchronized(new HashSet(), 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 null 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 trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException { + private static MultiStatus areSynchronized(Set 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) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/export/GeneratePDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/export/GeneratePDOM.java index fbd6182c35b..6312b599510 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/export/GeneratePDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/export/GeneratePDOM.java @@ -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 *
    @@ -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 true to check index completeness before exporting, or + * false 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 exportProperties= pm.getExportProperties(); - if(exportProperties!=null) { - for(Map.Entry 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 exportProperties= pm.getExportProperties(); + if (exportProperties != null) { + for(Map.Entry 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 { From cd70733735969a528e47a837a4acdbd7970d775f Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Mon, 14 Jan 2013 15:49:57 -0500 Subject: [PATCH 03/29] Bug 378834 - Re-order debug tests to avoid hanging on Hudson. I don't know why this helps, but it does. Change-Id: Iad4b653169d7b62af5cb2dbcfb93bdded2427f65 --- .../eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java | 2 +- .../cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java index c541b30eb78..ad053dda7f4 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java @@ -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 */ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java index 2a73f37ffe3..aa3edd8421e 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java @@ -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, From 42e044251bf27638c13e8b7493d8495f77526142 Mon Sep 17 00:00:00 2001 From: Vivian Kong Date: Mon, 14 Jan 2013 16:26:51 -0500 Subject: [PATCH 04/29] Bug 398131 - Method syntax coloring/highlighting shifted to wrong position in preview window --- .../CEditorColoringConfigurationBlock.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java index f394643dff9..3c854278173 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java @@ -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 @@ -912,11 +912,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 +925,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) }, }; } From 997f7b660705a717b99f3e97b6bb76d28be76c6c Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Mon, 14 Jan 2013 17:02:36 -0500 Subject: [PATCH 05/29] Fix qt template to use variable instead of test data. --- .../templates/project/helloWorld/qtQuick2/Basename.qml | 2 +- .../templates/project/helloWorld/qtQuick2/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Basename.qml b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Basename.qml index 897812a6cb4..2ff2ef6170c 100644 --- a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Basename.qml +++ b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Basename.qml @@ -4,7 +4,7 @@ Rectangle { width: 360 height: 360 Text { - text: qsTr("Hello World") + text: qsTr("Hello World from $(baseName)") anchors.centerIn: parent } MouseArea { diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Makefile b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Makefile index 86932e1beb6..5a41246df1d 100644 --- a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Makefile +++ b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/Makefile @@ -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 From dc114aff98849341abb32e858cb23018ea9ebd48 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Mon, 14 Jan 2013 17:19:44 -0500 Subject: [PATCH 06/29] Bug 398136 - ILaunchable is confusing Bug 398137 - Exporters/Importers should be filterable based on the address size they support --- debug/org.eclipse.cdt.debug.ui/plugin.xml | 6 +- .../InvalidLaunchableAdapterFactory.java | 88 +++++++++++++++++++ .../ui/launch/LaunchMessages.properties | 3 + .../plugin.xml | 24 ++--- .../schema/MemoryTransport.exsd | 14 +++ .../memory/transport/ExportMemoryDialog.java | 32 ++++++- .../memory/transport/ImportMemoryDialog.java | 25 ++++++ .../memory/transport/PlainTextExporter.java | 15 ++++ 8 files changed, 191 insertions(+), 16 deletions(-) create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index fa6769bbf67..0188aa81f49 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -128,17 +128,17 @@ diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java new file mode 100644 index 00000000000..10ff510a19f --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java @@ -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 currentTraces = new ArrayList(); + + /* + * (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; + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LaunchMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LaunchMessages.properties index 65d1b918bef..d83a53bd822 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LaunchMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/LaunchMessages.properties @@ -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. + diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml b/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml index 10e7c942abb..abb815d87b5 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml @@ -7,17 +7,6 @@ name="%extension.name.0" point="org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"> - - - - - + + + + + diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/schema/MemoryTransport.exsd b/memory/org.eclipse.cdt.debug.ui.memory.transport/schema/MemoryTransport.exsd index cf963b11f26..ec7304db8f9 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/schema/MemoryTransport.exsd +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/schema/MemoryTransport.exsd @@ -77,6 +77,13 @@ + + + + Maximum size of the addressable memory this exporter can support in bits. + + + @@ -109,6 +116,13 @@ + + + + Maximum size of the addressable memory this importer can support in bits. + + + diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java index f279b04e2de..af4f639a596 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java @@ -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$ } } } diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java index 32d12aec9ce..4d91238617e 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java @@ -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$ diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index 2ad02b2260c..d5698f91bb1 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -280,6 +280,21 @@ public class PlainTextExporter implements IMemoryExporter { 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; } From d0c99408cd96fb912c003fd678fd4377bc984906 Mon Sep 17 00:00:00 2001 From: David Salinas Date: Tue, 15 Jan 2013 10:35:06 -0500 Subject: [PATCH 07/29] Bug 393455 - Terminal sessions broken on AIX --- .../META-INF/MANIFEST.MF | 2 +- core/org.eclipse.cdt.core.aix/library/PTY.h | 13 +++-- .../library/Spawner.h | 2 +- core/org.eclipse.cdt.core.aix/library/exec0.h | 13 +++-- .../library/exec_pty.c | 51 ++++++++++++------ .../library/exec_unix.c | 21 ++++++-- .../library/openpty.c | 2 +- .../library/openpty.h | 7 +-- core/org.eclipse.cdt.core.aix/library/pfind.c | 26 +++++++-- core/org.eclipse.cdt.core.aix/library/pty.c | 32 +++++++++-- .../library/spawner.c | 19 +++---- .../os/aix/ppc/libpty.so | Bin 11283 -> 12345 bytes .../os/aix/ppc/libspawner.so | Bin 27910 -> 31528 bytes core/org.eclipse.cdt.core.aix/pom.xml | 2 +- 14 files changed, 140 insertions(+), 50 deletions(-) diff --git a/core/org.eclipse.cdt.core.aix/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.aix/META-INF/MANIFEST.MF index 1ee36ed73f0..3faa5d1c085 100644 --- a/core/org.eclipse.cdt.core.aix/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.core.aix/META-INF/MANIFEST.MF @@ -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 diff --git a/core/org.eclipse.cdt.core.aix/library/PTY.h b/core/org.eclipse.cdt.core.aix/library/PTY.h index 46a8dd9b622..f717942a01d 100644 --- a/core/org.eclipse.cdt.core.aix/library/PTY.h +++ b/core/org.eclipse.cdt.core.aix/library/PTY.h @@ -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 } diff --git a/core/org.eclipse.cdt.core.aix/library/Spawner.h b/core/org.eclipse.cdt.core.aix/library/Spawner.h index 272366bad75..e2fea946912 100644 --- a/core/org.eclipse.cdt.core.aix/library/Spawner.h +++ b/core/org.eclipse.cdt.core.aix/library/Spawner.h @@ -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 diff --git a/core/org.eclipse.cdt.core.aix/library/exec0.h b/core/org.eclipse.cdt.core.aix/library/exec0.h index f0e88f36efe..630e741a582 100644 --- a/core/org.eclipse.cdt.core.aix/library/exec0.h +++ b/core/org.eclipse.cdt.core.aix/library/exec0.h @@ -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 @@ -16,7 +17,13 @@ #include 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); diff --git a/core/org.eclipse.cdt.core.aix/library/exec_pty.c b/core/org.eclipse.cdt.core.aix/library/exec_pty.c index 9eb60cf17e1..2c3a03ee0d4 100644 --- a/core/org.eclipse.cdt.core.aix/library/exec_pty.c +++ b/core/org.eclipse.cdt.core.aix/library/exec_pty.c @@ -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 /* 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); diff --git a/core/org.eclipse.cdt.core.aix/library/exec_unix.c b/core/org.eclipse.cdt.core.aix/library/exec_unix.c index a8399643a39..8c71787b618 100644 --- a/core/org.eclipse.cdt.core.aix/library/exec_unix.c +++ b/core/org.eclipse.cdt.core.aix/library/exec_unix.c @@ -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 /* 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); } diff --git a/core/org.eclipse.cdt.core.aix/library/openpty.c b/core/org.eclipse.cdt.core.aix/library/openpty.c index 954b2b6b852..2207e682532 100644 --- a/core/org.eclipse.cdt.core.aix/library/openpty.c +++ b/core/org.eclipse.cdt.core.aix/library/openpty.c @@ -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 diff --git a/core/org.eclipse.cdt.core.aix/library/openpty.h b/core/org.eclipse.cdt.core.aix/library/openpty.h index d07317e883b..21c98ac82fd 100644 --- a/core/org.eclipse.cdt.core.aix/library/openpty.h +++ b/core/org.eclipse.cdt.core.aix/library/openpty.h @@ -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 diff --git a/core/org.eclipse.cdt.core.aix/library/pfind.c b/core/org.eclipse.cdt.core.aix/library/pfind.c index ba64f8d6e7d..b97942e298d 100644 --- a/core/org.eclipse.cdt.core.aix/library/pfind.c +++ b/core/org.eclipse.cdt.core.aix/library/pfind.c @@ -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 #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 +} + + diff --git a/core/org.eclipse.cdt.core.aix/library/spawner.c b/core/org.eclipse.cdt.core.aix/library/spawner.c index b8707ca0e2b..710ae08e1de 100644 --- a/core/org.eclipse.cdt.core.aix/library/spawner.c +++ b/core/org.eclipse.cdt.core.aix/library/spawner.c @@ -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 @@ -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; diff --git a/core/org.eclipse.cdt.core.aix/os/aix/ppc/libpty.so b/core/org.eclipse.cdt.core.aix/os/aix/ppc/libpty.so index d5aed7004d4e8dcc749e2c709e013d803939f1f3..8caa860f81baa005f9f168d3e0f3da7395b24287 100644 GIT binary patch literal 12345 zcmc&)e{37o9sizvX`IAu+%0TbiQvjQl(AqZZQ8k21Wp@RT2crQM$n29*D*;}H@0G@ z4J=hJZRtwsL^eQ5r)o=~RE4oA+n9!?qNRYKX#InsZbI8M!YGrN%GPN}E2G5weBZtE zot?YbMQFR~;*Y=Y^FHr;-}mc#uU6h7we$V6_Yz(C1QGp<+8aGe6)8m3Tk-w(xG9S( zKuWzvbWkHjg-Ia~{;A}pa`N196SL-D!AyKK12fm<+tB3C+N%URB>rl_zGx;2s0n>K z2#9tA`24~Lg7FpcHxk^MPBVfJy?hJn{6Bgyk&O1mhixT`ULaapzz^8U|9^1I=Q;l9 z+u2JK3i%#eo}JqJ7ov$Mjq2kx8heLGe+l=Kq@IY8Z{lT?9V2zRk9^@?^0brpCcTwv zz>hR|i6T1r!@b#TJJDl0Y$)H%<+7|++M;X&Zw|bKw2e6M)=J*T;I-L#Xs@lF+uK8? z=3>dc1TNdy|2DM$6bGH_>Iw~v`Mk%&%c*xSp7&OryPGeqRaX?nz;uZ!Qkna=_asyC zAz|Y9ATHC0PdC~fm>3s6C&D^EzxqD6YkPifd!U^>yQDuK!5^P&zgxE7nb$UX%(lBl z+i9z9c0jg2h4u%~&M4X+n>b4P#3|Z0@irYmKhPweFO2(^?A&VZw~0QYg8n!nViF?? zk25cOJ$Pd_UY%LqPRc3iJNIKB>^jG~bq@u&E}rdnG)ekV+E-sD?EK7QI%^v-QMf+J z56E)X7UeCv?hEhB^doL%MjOzv^-F$S%FMW2pmOdG^b6W8yb9yP&tdrKeU00Yaq!_; z8d28K6)R66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v2{_^N$mt7WB zvC^|_HL#fbf7TPDgOsk6{Qq(0BB-0+Tw^rNDbtk3`Z>kWEpWQGo5kC6$giuGrH#xX zy0eAp*7+tQ&pl~Z&ZT|w{TKfOsneZvrE!kkUa>$hKUIu58Z@1c>-|p5Jg%c+_J9Y7 S$%B9DN=*HTXv}(e_5T1t_1{te diff --git a/core/org.eclipse.cdt.core.aix/pom.xml b/core/org.eclipse.cdt.core.aix/pom.xml index 10b13960c8a..e2d76453c16 100644 --- a/core/org.eclipse.cdt.core.aix/pom.xml +++ b/core/org.eclipse.cdt.core.aix/pom.xml @@ -11,7 +11,7 @@ ../../pom.xml - 5.1.1-SNAPSHOT + 5.3.0-SNAPSHOT org.eclipse.cdt.core.aix eclipse-plugin From 62fa04403152027d2bf9b88c931afcdca81a946c Mon Sep 17 00:00:00 2001 From: cabernal Date: Mon, 14 Jan 2013 12:46:25 -0500 Subject: [PATCH 08/29] Implement problem marker for AC_CHECK_LIB macro. Fix for https://fedorahosted.org/eclipse-packagekit/ticket/5 . Change-Id: Ic4466a7eb04c4acc5749eafd0536364c53ae6fdb Reviewed-on: https://git.eclipse.org/r/9663 Reviewed-by: Jeff Johnston IP-Clean: Jeff Johnston Tested-by: Jeff Johnston --- .../cdt/internal/autotools/core/AutotoolsProblemMarkerInfo.java | 2 +- .../org/eclipse/cdt/internal/autotools/core/ErrorParser.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsProblemMarkerInfo.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsProblemMarkerInfo.java index 62f3489a245..195c39679bf 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsProblemMarkerInfo.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsProblemMarkerInfo.java @@ -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; diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java index a6725458419..ffd1ef57133 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/ErrorParser.java @@ -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; } From 4811216ec478de5971f300483c2c2778279a0d1c Mon Sep 17 00:00:00 2001 From: Martin Oberhuber Date: Tue, 15 Jan 2013 16:50:16 +0100 Subject: [PATCH 09/29] Bug 398195 - Consider external ReadOnlyPDOMProvider in Include Browser Change-Id: Iebb2e9bd7c40e3fbfa4beb380208e06d3cb5e49e Reviewed-on: https://git.eclipse.org/r/9682 Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../eclipse/cdt/internal/ui/includebrowser/IBViewPart.java | 7 +++++-- .../cdt/internal/ui/includebrowser/IncludeBrowserUI.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java index a1e011e4d9c..7ce213219c7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java @@ -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)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IncludeBrowserUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IncludeBrowserUI.java index 0421681c7a8..c78d9c6ea5b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IncludeBrowserUI.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IncludeBrowserUI.java @@ -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); From 23a2d90279ae6f244e7a12e34a5ebffebf483858 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 15 Jan 2013 16:51:46 -0800 Subject: [PATCH 10/29] Bug 398254 - Syntax error in A<::B> a; --- .../core/parser/tests/scanner/LexerTests.java | 24 ++++++++++++++++++- .../internal/core/parser/scanner/Lexer.java | 15 ++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java index 23bdc2bd11a..9db25695eb1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java @@ -201,7 +201,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(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java index 439e2a910fb..40e1341fee3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java @@ -582,8 +582,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); From 93619fcb12b1f6ada22c9b12667be38023e13d3b Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 15 Jan 2013 16:58:33 -0800 Subject: [PATCH 11/29] Cosmetics. --- .../core/parser/tests/scanner/LexerTests.java | 5 +- .../internal/core/parser/scanner/Lexer.java | 65 ++++++++++--------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java index 9db25695eb1..a9a98d581b5 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java @@ -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; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java index 40e1341fee3..e05600d95a9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java @@ -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); @@ -602,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); @@ -647,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); @@ -730,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)); @@ -763,7 +764,7 @@ 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; @@ -774,8 +775,8 @@ final public class Lexer implements ITokenSequence { } } - 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; @@ -799,11 +800,11 @@ final public class Lexer implements ITokenSequence { } } } - 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 { @@ -813,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)); @@ -846,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': @@ -860,7 +861,7 @@ final public class Lexer implements ITokenSequence { case '\\': // universal character name markPhase3(); - switch(nextCharPhase3()) { + switch (nextCharPhase3()) { case 'u': case 'U': length++; break; @@ -915,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': @@ -963,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; @@ -1024,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; @@ -1032,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; } @@ -1041,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') { @@ -1091,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 '['; @@ -1112,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; @@ -1151,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; } @@ -1171,7 +1172,7 @@ final public class Lexer implements ITokenSequence { final char[] result= new char[imageLength]; markPhase3(); fEndOffset= offset; - for (int idx=0; idx Date: Tue, 15 Jan 2013 18:17:44 -0800 Subject: [PATCH 12/29] Cosmetics. --- .../internal/core/parser/scanner/Lexer.java | 8 +- .../cdt/ui/tests/text/CPartitionerTest.java | 85 +------------------ .../CEditorColoringConfigurationBlock.java | 26 +----- .../CEditorColoringPreferencePage.java | 17 ---- .../ui/text/CPreprocessorScanner.java | 1 - .../ui/text/FastCPartitionScanner.java | 50 +++-------- .../internal/ui/text/FastCPartitioner.java | 3 +- 7 files changed, 25 insertions(+), 165 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java index e05600d95a9..f65f9dcb5da 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Lexer.java @@ -770,7 +770,7 @@ final public class Lexer implements ITokenSequence { break; } if (fInput.get(delimEndOffset) == '(') { - offset= delimEndOffset+1; + offset= delimEndOffset + 1; break; } } @@ -784,17 +784,17 @@ 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; } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java index 2db46de0a21..f6b3c886e7e 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java @@ -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 \n"); // "xxx\n/*xxx*/\nxxx\n/**xxx*/\nxxx\n/**/\nx\"yyy\"x\n/***/\nxxx"); // "xxx\n # include \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,7 +1335,6 @@ public class CPartitionerTest extends TestCase { public void testEditingRawString3() { try { - fDocument.replace(0, fDocument.getLength(), "/***/R\"(line 1\nline 2\nline 3\n)\" \"str\""); ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength()); TypedRegion[] expectation= { @@ -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); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java index 3c854278173..96c64d82e3a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java @@ -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; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringPreferencePage.java index 899beb8ea5d..bb1e7e23b3b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringPreferencePage.java @@ -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. *

    @@ -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); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java index 9df46645426..fc1df9c0ab3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java @@ -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, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java index e71dc08a7a1..c197b2cb0f3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java @@ -13,7 +13,6 @@ *******************************************************************************/ 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 +23,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 +112,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa */ @Override public IToken nextToken() { - fTokenOffset += fTokenLength; fTokenLength= fPrefixLength; @@ -135,7 +131,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 +160,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa fState= CCODE; return token; - } else { consume(); continue; @@ -220,7 +214,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa case STRING: case PREPROCESSOR: case PREPROCESSOR_STRING: - int last; int newState; switch (ch) { @@ -304,7 +297,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa fTokenLength= fPrefixLength; break; } - } else { fTokenLength++; fLast= SLASH; @@ -321,7 +313,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa fTokenLength= fPrefixLength; break; } - } else { consume(); break; @@ -603,7 +594,6 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa case BACKSLASH_CR: case BACKSLASH_BACKSLASH: return 2; - } } @@ -624,7 +614,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 +623,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 +686,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 +721,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; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitioner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitioner.java index 6965b4f9c1b..0fdd032e765 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitioner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitioner.java @@ -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; From 4a0cfa6cc4d0d6db370a00b923161bffefbd1fdc Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 15 Jan 2013 19:15:48 -0800 Subject: [PATCH 13/29] Bug 396439 - Syntax highlighting is wrong for raw strings --- .../ui/text/FastCPartitionScanner.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java index c197b2cb0f3..f799aaa4633 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java @@ -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,6 +10,7 @@ * QNX Software System * Anton Leherbauer (Wind River Systems) * Andrew Ferguson (Symbian) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.ui.text; @@ -518,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; From 6369aad37784f0eb50ebe836071dcb9827049105 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 16 Jan 2013 11:06:08 -0800 Subject: [PATCH 14/29] Cosmetics. --- .../eclipse/cdt/ui/tests/text/CPartitionerTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java index f6b3c886e7e..236049d17bd 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java @@ -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) From 7c58fc5f3319cd8ecd37f3196dc586e660576123 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 16 Jan 2013 11:11:12 -0800 Subject: [PATCH 15/29] Bug 396439 - Syntax highlighting is wrong for raw strings. Added a test case. --- .../ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java index 236049d17bd..0f792db66c2 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java @@ -1335,7 +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), From 7bbf2d8511e8e1fc866f5b3d3edd4460f6e5b0f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Jan 2013 17:37:03 -0500 Subject: [PATCH 16/29] Bug 398329 : MemoryBrowser - switching between debuggees does not update the provider for browser operations like Import and Export Bug 398332 : The validation logic and feedback for all of the Importers/Exporters is very bad --- .../memory/memorybrowser/MemoryBrowser.java | 4 +- .../plugin.xml | 2 - .../memory/transport/PlainTextExporter.java | 98 +++++++++------ .../memory/transport/PlainTextImporter.java | 6 +- .../memory/transport/RAWBinaryExporter.java | 98 +++++++++------ .../memory/transport/RAWBinaryImporter.java | 6 +- .../ui/memory/transport/SRecordExporter.java | 113 ++++++++++++------ .../ui/memory/transport/SRecordImporter.java | 23 +++- .../ui/memory/transport/messages.properties | 2 + 9 files changed, 231 insertions(+), 121 deletions(-) diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java index 8a854788544..b26235a224a 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java @@ -994,7 +994,9 @@ 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(); + getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING))); + handleTabActivated(tabItem); } else { tabFolder = createTabFolder(fRenderingsComposite); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml b/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml index abb815d87b5..9df3435c186 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/plugin.xml @@ -32,13 +32,11 @@ diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index d5698f91bb1..35766ded478 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -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$ @@ -189,26 +189,26 @@ 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 actualLength = getEndAddress().subtract(getStartAddress()); + 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)); + } } 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 +219,22 @@ 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 endAddress = getEndAddress(); - BigInteger startAddress = getStartAddress(); - - String lengthString = endAddress.subtract(startAddress).toString(); + BigInteger actualLength = getEndAddress().subtract(getStartAddress()); + fLengthText.setText(actualLength.toString()); - if(!fLengthText.getText().equals(lengthString)) - 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)); + } } catch(Exception ex) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); + fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } validate(); @@ -246,22 +248,30 @@ 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)); - BigInteger startAddress = getStartAddress(); - String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$ - if(!fEndText.getText().equals(endString)) - fEndText.setText(endString); + + BigInteger length = getLength(); + String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$ + fStartText.setText(fStartText.getText().trim()); + 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)); + } } 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,9 +283,7 @@ public class PlainTextExporter implements IMemoryExporter { validate(); } - public void keyPressed(KeyEvent e) { - - } + public void keyPressed(KeyEvent e) {} }); composite.pack(); @@ -301,6 +309,7 @@ public class PlainTextExporter 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); @@ -311,6 +320,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); @@ -321,6 +331,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); @@ -340,7 +351,6 @@ public class PlainTextExporter implements IMemoryExporter { try { getEndAddress(); - getStartAddress(); BigInteger length = getLength(); @@ -348,8 +358,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) { @@ -357,7 +378,6 @@ public class PlainTextExporter implements IMemoryExporter { } fParentDialog.setValid(isValid); - } public String getId() diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java index 85de142c2d6..acb587d00c2 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java @@ -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); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java index cfa505cdc05..0a622e17333 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java @@ -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$ @@ -190,26 +190,26 @@ 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 actualLength = getEndAddress().subtract(getStartAddress()); + 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)); + } } 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 +220,22 @@ 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 endAddress = getEndAddress(); - BigInteger startAddress = getStartAddress(); - - String lengthString = endAddress.subtract(startAddress).toString(); + BigInteger actualLength = getEndAddress().subtract(getStartAddress()); + fLengthText.setText(actualLength.toString()); - if(!fLengthText.getText().equals(lengthString)) - 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)); + } } catch(Exception ex) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); + fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } validate(); @@ -247,22 +249,30 @@ 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)); - BigInteger startAddress = getStartAddress(); - String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$ - if(!fEndText.getText().equals(endString)) - fEndText.setText(endString); + + BigInteger length = getLength(); + String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$ + fStartText.setText(fStartText.getText().trim()); + 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)); + } } 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 +284,7 @@ public class RAWBinaryExporter implements IMemoryExporter validate(); } - public void keyPressed(KeyEvent e) { - - } + public void keyPressed(KeyEvent e) {} }); composite.pack(); @@ -303,6 +311,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 +322,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 +333,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 +353,6 @@ public class RAWBinaryExporter implements IMemoryExporter try { getEndAddress(); - getStartAddress(); BigInteger length = getLength(); @@ -350,8 +360,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 +381,6 @@ public class RAWBinaryExporter implements IMemoryExporter fParentDialog.setValid(isValid); } - public String getId() { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java index e6337fe2230..8d1ccb8c1b6 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java @@ -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); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java index f5786fb0cb3..c76326874f8 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java @@ -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,24 @@ 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 actualLength = getEndAddress().subtract(getStartAddress()); + 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)); } - 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 +273,25 @@ 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(); } 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 +302,29 @@ 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)); + + BigInteger length = getLength(); 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()); + 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)); } - validate(); } 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 +366,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 +381,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 +396,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 +417,6 @@ public class SRecordExporter implements IMemoryExporter try { getEndAddress(); - getStartAddress(); BigInteger length = getLength(); @@ -389,8 +424,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 +445,6 @@ public class SRecordExporter implements IMemoryExporter fParentDialog.setValid(isValid); } - public String getId() { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java index 0dd47576b25..56368d7b15c 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java @@ -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); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties index 27f4885ad59..30bb04fb2d8 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties @@ -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: From 98e5959c90e5bd3484445844e8e50478253b2a24 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 17 Jan 2013 15:20:49 -0500 Subject: [PATCH 17/29] Added template process to add nature. Added Qt nature. --- core/org.eclipse.cdt.core/plugin.xml | 10 ++++ .../process/processes/AddNature.java | 56 +++++++++++++++++++ .../process/processes/messages.properties | 2 + .../META-INF/MANIFEST.MF | 1 + qt/org.eclipse.cdt.qt.core/plugin.xml | 9 +++ .../src/org/eclipse/cdt/qt/core/QtNature.java | 40 +++++++++++++ .../project/helloWorld/qtQuick2/template.xml | 6 +- 7 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java create mode 100644 qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index d65aa20c4ff..7cd1e698f09 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -771,6 +771,16 @@ + + + + + + diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java new file mode 100644 index 00000000000..70e2d18cd8c --- /dev/null +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * 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 + * + */ +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); + } + } + +} diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/messages.properties b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/messages.properties index d100e9797dd..ad8ca201f2d 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/messages.properties +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/messages.properties @@ -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 diff --git a/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF b/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF index 552ea94b6c2..b4ca9e8d545 100644 --- a/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF +++ b/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF @@ -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 diff --git a/qt/org.eclipse.cdt.qt.core/plugin.xml b/qt/org.eclipse.cdt.qt.core/plugin.xml index d0ab3f8001e..959e78450a5 100644 --- a/qt/org.eclipse.cdt.qt.core/plugin.xml +++ b/qt/org.eclipse.cdt.qt.core/plugin.xml @@ -41,4 +41,13 @@ priority="normal"> + + + + + + diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java new file mode 100644 index 00000000000..f58e2cd190e --- /dev/null +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtNature.java @@ -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; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/template.xml b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/template.xml index c80a589e17c..58bdd9e8b00 100644 --- a/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/template.xml +++ b/qt/org.eclipse.cdt.qt.core/templates/project/helloWorld/qtQuick2/template.xml @@ -56,6 +56,10 @@ + + + + + - From adb89806d80888511f06daa0446f211be4a79ff2 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Thu, 17 Jan 2013 16:02:35 -0800 Subject: [PATCH 18/29] Bug 398459 - Invalid auto-indentation in a virtual method --- .../org/eclipse/cdt/ui/tests/text/CIndenterTest.java | 4 ++-- .../org/eclipse/cdt/internal/ui/text/CIndenter.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java index 52fac36670d..e1389e636aa 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java @@ -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(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java index cb08370dc4e..14fe12bf58d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java @@ -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()) From 6aebe7dcd584bb390a4ddac868e9f22a5009e6a2 Mon Sep 17 00:00:00 2001 From: Chris Recoskie Date: Fri, 18 Jan 2013 11:15:50 -0800 Subject: [PATCH 19/29] Bug 398499 - FileContent.adapt(CodeReader) does not properly set timestamps Change-Id: I57fdacfc2fef225a6b3942b1be185ae79bb28c31 Reviewed-on: https://git.eclipse.org/r/9756 Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin IP-Clean: Chris Recoskie Reviewed-by: Chris Recoskie --- .../org/eclipse/cdt/core/parser/FileContent.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java index fd7085fbd78..748a2245ad6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java @@ -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); } } From 4b22b8c6bc6201ca9b27ed9e9bc9ea602e7ab661 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 17 Jan 2013 12:39:35 -0500 Subject: [PATCH 20/29] Bug 398426 - Use num procs - 1 on Mac for optimal parallel builds. Changed the text of the UI since optimal is not always number of processors. --- .../eclipse/cdt/managedbuilder/internal/core/Builder.java | 8 +++++++- .../cdt/managedbuilder/internal/ui/Messages.properties | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java index 3f6b3818677..55f4995f5c3 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java @@ -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; } /** diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties index 59bc380dca0..ac4acf5dce1 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties @@ -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 From 46598455db3dc1f096a296a5735edb069f6838b2 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Fri, 18 Jan 2013 16:59:30 -0500 Subject: [PATCH 21/29] Bug 398329 : MemoryBrowser - switching between debuggees does not update the provider for browser operations like Import and Export Bug 398332 : The validation logic and feedback for all of the Importers/Exporters is very bad I found some more editing edge cases as well as an NPE on starting a new connection with the Browser up, which was the result of a previous edit. --- .../memory/memorybrowser/MemoryBrowser.java | 4 +- .../memory/transport/PlainTextExporter.java | 88 +++++++++++++++++-- .../memory/transport/RAWBinaryExporter.java | 88 +++++++++++++++++-- .../ui/memory/transport/SRecordExporter.java | 54 +++++++++++- 4 files changed, 220 insertions(+), 14 deletions(-) diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java index b26235a224a..21c1584aae9 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java @@ -995,7 +995,9 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM if(tabFolder != null) { fStackLayout.topControl = tabFolder; CTabItem tabItem = (CTabItem) tabFolder.getSelection(); - getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING))); + if ( tabItem != null ) { + getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING))); + } handleTabActivated(tabItem); } else { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index 35766ded478..ffeb18f5788 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -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() { @@ -195,13 +225,25 @@ public class PlainTextExporter implements IMemoryExporter { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger actualLength = getEndAddress().subtract(getStartAddress()); + 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) { @@ -230,6 +272,18 @@ public class PlainTextExporter implements IMemoryExporter { 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(); + 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) { @@ -252,15 +306,39 @@ public class PlainTextExporter implements IMemoryExporter { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger length = getLength(); - String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$ 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$ + } + } + 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) { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java index 0a622e17333..1f4190cafbd 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java @@ -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() { @@ -196,13 +226,25 @@ public class RAWBinaryExporter implements IMemoryExporter fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger actualLength = getEndAddress().subtract(getStartAddress()); + 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) { @@ -231,6 +273,18 @@ public class RAWBinaryExporter implements IMemoryExporter 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(); + 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) { @@ -253,15 +307,39 @@ public class RAWBinaryExporter implements IMemoryExporter fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger length = getLength(); - String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$ 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$ + } + } + 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) { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java index c76326874f8..9484110a842 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java @@ -249,13 +249,25 @@ public class SRecordExporter implements IMemoryExporter fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger actualLength = getEndAddress().subtract(getStartAddress()); + 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) { @@ -284,6 +296,18 @@ public class SRecordExporter implements IMemoryExporter 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(); + 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) { @@ -306,15 +330,39 @@ public class SRecordExporter implements IMemoryExporter fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); - BigInteger length = getLength(); - String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$ 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$ + } + } + 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) { From aa8cd5bb090f90c7d5b6d3e48eba683ebfbea356 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 18 Jan 2013 11:55:33 -0800 Subject: [PATCH 22/29] Cosmetics. --- .../parser/org/eclipse/cdt/core/parser/FileContent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java index 748a2245ad6..8594ace9c3c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java @@ -141,6 +141,6 @@ public abstract class FileContent { 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); + return new InternalFileContent(filePath, chars, file.lastModified(), file.length(), fileReadTime); } } From d3a15b651c37cbe059e2c744ac9e7fa745198aea Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 18 Jan 2013 15:18:50 -0800 Subject: [PATCH 23/29] Bug 398550. An attempt to make MBSLanguageSettingsProvider.getSettingEntries method faster. --- .../providers/MBSLanguageSettingsProvider.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java index 3c66105c2ed..17bc5530c25 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java @@ -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 list = new ArrayList(); + Set set = new LinkedHashSet(); 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(set)); } /** From b8d75b789e409397951a0a24e3986a41c2517806 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sat, 19 Jan 2013 06:41:00 -0500 Subject: [PATCH 24/29] Revert "Bug 398550. An attempt to make MBSLanguageSettingsProvider.getSettingEntries method faster." This reverts commit d3a15b651c37cbe059e2c744ac9e7fa745198aea. --- .../providers/MBSLanguageSettingsProvider.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java index 17bc5530c25..3c66105c2ed 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Andrew Gvozdev and others. + * Copyright (c) 2009, 2011 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,9 +12,7 @@ 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; @@ -61,7 +59,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase languageSettings = getLanguageSettings(rcDescription); } - Set set = new LinkedHashSet(); + List list = new ArrayList(); if (languageSettings != null) { for (ICLanguageSetting langSetting : languageSettings) { @@ -88,8 +86,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 (!set.contains(projectRootedEntry)) { - set.add(projectRootedEntry); + if (! list.contains(projectRootedEntry)) { + list.add(projectRootedEntry); } } } catch (CdtVariableException e) { @@ -99,8 +97,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase } } - if (!set.contains(entry)) { - set.add(entry); + if (! list.contains(entry)) { + list.add(entry); } } } @@ -109,7 +107,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase } } } - return LanguageSettingsStorage.getPooledList(new ArrayList(set)); + return LanguageSettingsStorage.getPooledList(list); } /** From 0bd71331683151103f37190242741eae66fea60f Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sat, 19 Jan 2013 06:46:22 -0500 Subject: [PATCH 25/29] Revert "Revert "Bug 398550. An attempt to make MBSLanguageSettingsProvider.getSettingEntries method faster."" This reverts commit b8d75b789e409397951a0a24e3986a41c2517806. --- .../providers/MBSLanguageSettingsProvider.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java index 3c66105c2ed..17bc5530c25 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/MBSLanguageSettingsProvider.java @@ -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 list = new ArrayList(); + Set set = new LinkedHashSet(); 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(set)); } /** From 36dd99f43572f98276f8044088208a203e4a37b6 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sat, 19 Jan 2013 16:37:08 -0500 Subject: [PATCH 26/29] bug 398550: Use platform decorator manager to manage 'custom build settings' decoration --- core/org.eclipse.cdt.ui/plugin.properties | 2 + core/org.eclipse.cdt.ui/plugin.xml | 16 ++ .../CustomBuildSettingsDecorator.java | 93 ++++++++++++ .../viewsupport/ProblemsLabelDecorator.java | 141 +----------------- .../cdt/ui/CElementImageDescriptor.java | 18 +-- 5 files changed, 126 insertions(+), 144 deletions(-) create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CustomBuildSettingsDecorator.java diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index ec2b1af6ed5..51c079b50e5 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -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 diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 727ae91b283..7b23e99066c 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -4156,6 +4156,22 @@ + + %CustomBuildSettingsDecorator.description + + + + + + + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CustomBuildSettingsDecorator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CustomBuildSettingsDecorator.java new file mode 100644 index 00000000000..e526a42d9e5 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CustomBuildSettingsDecorator.java @@ -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 list = provider.getSettingEntries(cfgDescription, rc, languageId); + if (list != null) { + List 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 + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java index 21ec525f43c..9e9bb99d4e3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java @@ -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 null 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 -1, 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 list = provider.getSettingEntries(cfgDescription, rc, languageId); - if (list != null) { - List 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; - } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java index 2b94f32ab4c..41f624f79d7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java @@ -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() { From f8f7aea5d41c8af010beae071e1397a1317119a2 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 20 Jan 2013 22:07:53 -0500 Subject: [PATCH 27/29] Missing @since tag --- .../cdt/core/templateengine/process/processes/AddNature.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java index 70e2d18cd8c..316908dc3e7 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java @@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IStatus; /** * @author dschaefer + * @since 5.5 * */ public class AddNature extends ProcessRunner { From c1a87bc4a7b937ce9e1049d4b5d676a43a22315a Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 20 Jan 2013 20:40:29 -0800 Subject: [PATCH 28/29] Cosmetics. --- .../ui/editor/AbstractCModelOutlinePage.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AbstractCModelOutlinePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AbstractCModelOutlinePage.java index e7640ba8e12..95cf35fb74f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AbstractCModelOutlinePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AbstractCModelOutlinePage.java @@ -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)); } - } From ca03d0d23ac88ed9f85a5ca693253da833cc9378 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 20 Jan 2013 20:51:40 -0800 Subject: [PATCH 29/29] Bug 398611 - Set input for the Outline page conditionally to avoid unnecessary updates. --- .../eclipse/cdt/internal/ui/editor/CEditor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 2d4c743da09..070355e1c15 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -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 true if folding is enabled, false otherwise.