# HG changeset patch
# User timkelly
# Date 1249511739 18000
# Node ID 49c226a8748eb78c9e75d80adf60e1edab345aab
# Parent fcb77f9783d2c410f5e70d8859fd004c67d10b0c
CDT 6.0 from cdt_6_0 branch (eclipse.org cvs repository). This overwrites previous CDT 6.0 merges.
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt-feature/feature.xml
--- a/cdt/cdt_6_0_x/org.eclipse.cdt-feature/feature.xml Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt-feature/feature.xml Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/CdtVariableResolverTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/CdtVariableResolverTest.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Andrew Gvozdev (Quoin 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:
- *
- *******************************************************************************/
-package org.eclipse.cdt.utils;
-
-import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
-import org.eclipse.cdt.core.cdtvariables.ICdtVariableStatus;
-import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
-import org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class CdtVariableResolverTest extends TestCase {
-
- public static Test suite() {
- return new TestSuite(CdtVariableResolverTest.class);
- }
-
- private class MockSubstitutor implements IVariableSubstitutor {
-
- public String resolveToString(String macroName)
- throws CdtVariableException {
- if (macroName.equals("null")) {
- return null;
- }
- if (macroName.equals("loop")) {
- return "${LOOP}";
- }
- if (macroName.equals("LOOP")) {
- return "${loop}";
- }
- if (macroName.equals("throw")) {
- throw new CdtVariableException(ICdtVariableStatus.TYPE_MACRO_UNDEFINED,null,null,null);
- }
- return "#"+macroName+"#";
- }
-
- public String[] resolveToStringList(String macroName)
- throws CdtVariableException {
-
- if (macroName.equals("null-to-list")) {
- return null;
- }
-
- if (macroName.equals("PATH")) {
- return new String[] {
- "path0",
- "path1",
- "path2",
- };
- }
- return new String[] {"@"+macroName+"@"};
- }
-
- }
- private MockSubstitutor mockSubstitutor = new MockSubstitutor();
-
- public void testResolveToString() throws CdtVariableException {
-
- assertEquals("",CdtVariableResolver.resolveToString(null, mockSubstitutor));
- assertEquals("",CdtVariableResolver.resolveToString("", mockSubstitutor));
- assertEquals("Text",CdtVariableResolver.resolveToString("Text", mockSubstitutor));
- assertEquals("#Macro#",CdtVariableResolver.resolveToString("${Macro}", mockSubstitutor));
- assertEquals("",CdtVariableResolver.resolveToString("${}", mockSubstitutor));
- assertEquals("${Nomacro",CdtVariableResolver.resolveToString("${Nomacro", mockSubstitutor));
- assertEquals("Nomacro}",CdtVariableResolver.resolveToString("Nomacro}", mockSubstitutor));
- assertEquals("Text/#Macro#",CdtVariableResolver.resolveToString("Text/${Macro}", mockSubstitutor));
- assertEquals("#Macro#/Text",CdtVariableResolver.resolveToString("${Macro}/Text", mockSubstitutor));
- assertEquals("#Macro1#/#Macro2#",CdtVariableResolver.resolveToString("${Macro1}/${Macro2}", mockSubstitutor));
- assertEquals("${Macro}",CdtVariableResolver.resolveToString("\\${Macro}", mockSubstitutor));
- assertEquals("${Macro}:#Macro#",CdtVariableResolver.resolveToString("\\${Macro}:${Macro}", mockSubstitutor));
- assertEquals("\\#Macro#",CdtVariableResolver.resolveToString("\\\\${Macro}", mockSubstitutor));
- assertEquals("\\${Macro}",CdtVariableResolver.resolveToString("\\\\\\${Macro}", mockSubstitutor));
- assertEquals("C:\\tmp\\",CdtVariableResolver.resolveToString("C:\\tmp\\", mockSubstitutor));
-
- assertEquals("#workspace_loc:#Macro##",CdtVariableResolver.resolveToString("${workspace_loc:${Macro}}", mockSubstitutor));
- assertEquals("#workspace_loc:#Macro1#/#Macro2##",CdtVariableResolver.resolveToString("${workspace_loc:${Macro1}/${Macro2}}", mockSubstitutor));
- assertEquals("#workspace_loc:#project_loc:/#Macro###",CdtVariableResolver.resolveToString("${workspace_loc:${project_loc:/${Macro}}}", mockSubstitutor));
-
- }
-
- public void testExceptions() throws CdtVariableException {
- // test exceptions
- try {
- assertEquals("Unreacheable",CdtVariableResolver.resolveToString("${null}", mockSubstitutor));
- fail("Exception expected");
- } catch (CdtVariableException e) {
- // expected behavior
- }
- try {
- assertEquals("Unreacheable",CdtVariableResolver.resolveToString("${throw}", mockSubstitutor));
- fail("Exception expected");
- } catch (CdtVariableException e) {
- // expected behavior
- }
-
- // make sure there is no infinite loop
- assertEquals("${LOOP}",CdtVariableResolver.resolveToString("${loop}", mockSubstitutor));
- }
-
- public void testAsList() throws CdtVariableException {
- // Syntax ${var} implies using substitutor.resolveToStringList(...)
- {
- String[] list = CdtVariableResolver.resolveToStringList("${PATH}", mockSubstitutor);
-
- assertNotNull(list);
- assertEquals(3,list.length);
- assertEquals("path0",list[0]);
- assertEquals("path1",list[1]);
- assertEquals("path2",list[2]);
- }
-
- // uses substitutor.resolveToString(...)
- {
- String[] list = CdtVariableResolver.resolveToStringList("Text", mockSubstitutor);
-
- assertNotNull(list);
- assertEquals(1,list.length);
- assertEquals("Text",list[0]);
- }
-
- // uses substitutor.resolveToString(...)
- {
- String[] list = CdtVariableResolver.resolveToStringList("Text${PATH}", mockSubstitutor);
-
- assertNotNull(list);
- assertEquals(1,list.length);
- assertEquals("Text#PATH#",list[0]);
- }
-
- // uses substitutor.resolveToString(...)
- {
- String[] list = CdtVariableResolver.resolveToStringList("${PATH}${PATH}", mockSubstitutor);
-
- assertNotNull(list);
- assertEquals(1,list.length);
- assertEquals("#PATH##PATH#",list[0]);
- }
-
- // empty var delivers zero-length array
- {
- String[] list = CdtVariableResolver.resolveToStringList("${}", mockSubstitutor);
-
- assertNotNull(list);
- assertEquals(0,list.length);
- }
-
- // test exceptions
- try {
- CdtVariableResolver.resolveToStringList("${null-to-list}", mockSubstitutor);
- fail("Exception expected");
- } catch (CdtVariableException e) {
- // expected behavior
- }
- }
-
- // These tests are very basic not intended to be comprehensive
- public void testOtherBasic() throws CdtVariableException {
- assertEquals("${Macro}",CdtVariableResolver.createVariableReference("Macro"));
-
- {
- String[] list = { "1","2","3" };
- assertEquals("1;2;3",CdtVariableResolver.convertStringListToString(list,";"));
- }
-
- {
- String[] list = { "${PATH}", "${Macro}" };
- String[] result = CdtVariableResolver.resolveStringListValues(list, mockSubstitutor, true);
- assertEquals(4,result.length);
- assertEquals("path0",result[0]);
- assertEquals("path1",result[1]);
- assertEquals("path2",result[2]);
- assertEquals("@Macro@",result[3]);
- }
- }
-
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java Wed Aug 05 17:35:39 2009 -0500
@@ -669,28 +669,28 @@
parse(getAboveComment(), ParserLanguage.CPP, false, 0);
}
- // class X; // X is an incomplete type
- // extern X* xp; // xp is a pointer to an incomplete type
- // extern int arr[]; // the type of arr is incomplete
- // typedef int UNKA[]; // UNKA is an incomplete type
- // UNKA* arrp; // arrp is a pointer to an incomplete type
- // UNKA** arrpp;
- // void foo() {
- // xp++; //ill-formed: X is incomplete
- // arrp++; //ill-formed: incomplete type
- // arrpp++; //OK: sizeof UNKA* is known
- // }
- // struct X {
- // int i;
- // }; // now X is a complete type
- // int arr[10]; // now the type of arr is complete
- // X x;
- // void bar() {
- // xp = &x; // OK; type is ''pointer to X''
- // arrp = &arr; // ill-formed: different types
- // xp++; //OK: X is complete
- // arrp++; //ill-formed: UNKA can't be completed
- // }
+ // class X; // X is an incomplete type
+ // extern X* xp; // xp is a pointer to an incomplete type
+ // extern int arr[]; // the type of arr is incomplete
+ // typedef int UNKA[]; // UNKA is an incomplete type
+ // UNKA* arrp; // arrp is a pointer to an incomplete type
+ // UNKA** arrpp;
+ // void foo()
+ // {
+ // xp++; //illformed: X is incomplete
+ // arrp++; //illformed: incomplete type
+ // arrpp++; //OK: sizeof UNKA* is known
+ // }
+ // struct X { int i; }; // now X is a complete type
+ // int arr[10]; // now the type of arr is complete
+ // X x;
+ // void bar()
+ // {
+ // xp = &x; // OK; type is ''pointer to X''
+ // arrp = &arr; // illformed: different types
+ // xp++; //OK: X is complete
+ // arrp++; //illformed: UNKA can't be completed
+ // }
public void test3_9s7() throws Exception {
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
}
@@ -797,7 +797,7 @@
assertNull(newExpr.getNewPlacement());
assertNull(newExpr.getNewInitializer());
IASTTypeId typeid= newExpr.getTypeId();
- isTypeEqual(CPPVisitor.createType(typeid), "int (* [10])()");
+ isTypeEqual(CPPVisitor.createType(typeid), "int () * []");
}
// typedef int T;
@@ -835,7 +835,7 @@
newExpr= (ICPPASTNewExpression) expr;
assertNull(newExpr.getNewPlacement());
assertNull(newExpr.getNewInitializer());
- isTypeEqual(CPPVisitor.createType(newExpr.getTypeId()), "int [5]");
+ isTypeEqual(CPPVisitor.createType(newExpr.getTypeId()), "int []");
// new (2,f) T[5];
expr= getExpressionOfStatement(fdef, 3);
@@ -843,7 +843,7 @@
newExpr= (ICPPASTNewExpression) expr;
assertInstance(newExpr.getNewPlacement(), IASTExpressionList.class);
assertNull(newExpr.getNewInitializer());
- isTypeEqual(CPPVisitor.createType(newExpr.getTypeId()), "int [5]");
+ isTypeEqual(CPPVisitor.createType(newExpr.getTypeId()), "int []");
}
// int n=2;
@@ -1858,7 +1858,7 @@
BindingAssertionHelper ba= new BindingAssertionHelper(code, true);
IFunction f= ba.assertNonProblem("f", 1, IFunction.class);
- isTypeEqual(f.getType(), "void (int (*)(C))");
+ isTypeEqual(f.getType(), "void (int (C) *)");
}
// class C { };
@@ -1869,7 +1869,7 @@
parse(code, ParserLanguage.CPP, true, 0);
BindingAssertionHelper ba= new BindingAssertionHelper(code, true);
IFunction f= ba.assertNonProblem("h", 1, IFunction.class);
- isTypeEqual(f.getType(), "void (int * (*)(C *))");
+ isTypeEqual(f.getType(), "void (int * (C *) *)");
}
// namespace A {
@@ -2054,7 +2054,7 @@
// *pi,
// f(),
// *fpi(int),
- // (*pif)(const char*, const char*),
+ // (*pif)(const char*, const char*);
// (*fpif(int))(int);
public void test8_3_5s9a() throws Exception {
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java Wed Aug 05 17:35:39 2009 -0500
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Andrew Niefer (IBM Corporation) - initial API and implementation
+ * IBM Corporation - initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
@@ -121,6 +121,9 @@
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.parser.ParserException;
+/**
+ * @author aniefer
+ */
public class AST2CPPTests extends AST2BaseTest {
public AST2CPPTests() {
@@ -1086,7 +1089,7 @@
IFunction g = (IFunction) collector.getName(8).resolveBinding();
isTypeEqual(g.getType(), "void (char *)");
IFunction h = (IFunction) collector.getName(12).resolveBinding();
- isTypeEqual(h.getType(), "void (int (*)())");
+ isTypeEqual(h.getType(), "void (int () *)");
assertInstances(collector, f, 3);
assertInstances(collector, g, 2);
@@ -5743,10 +5746,10 @@
checkNewExpression(fdef, 10, IASTIdExpression.class, "int", IASTExpressionList.class);
checkNewExpression(fdef, 11, IASTIdExpression.class, "int", IASTIdExpression.class);
- checkNewExpression(fdef, 12, null, "int [][]", null);
- checkNewExpression(fdef, 13, IASTIdExpression.class, "int [][]", null);
- checkNewExpression(fdef, 14, null, "int [][]", null);
- checkNewExpression(fdef, 15, IASTIdExpression.class, "int [][]", null);
+ checkNewExpression(fdef, 12, null, "int [] []", null);
+ checkNewExpression(fdef, 13, IASTIdExpression.class, "int [] []", null);
+ checkNewExpression(fdef, 14, null, "int [] []", null);
+ checkNewExpression(fdef, 15, IASTIdExpression.class, "int [] []", null);
}
private void checkNewExpression(IASTFunctionDefinition fdef, int i_expr, Class> placement, String type, Class> init) {
@@ -7052,6 +7055,25 @@
parseAndCheckBindings(code, ParserLanguage.CPP);
}
+ // class C {
+ // C& operator()() {return *this;}
+ // };
+ // void test() {
+ // C c;
+ // c()()()()()()()()()()()()()();
+ // }
+ public void testNestedOverloadedFunctionCalls_Bug283324() throws Exception {
+ final String code = getAboveComment();
+ IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP);
+ IASTFunctionDefinition test= getDeclaration(tu, 1);
+ IASTExpressionStatement stmt= getStatement(test, 1);
+ long now= System.currentTimeMillis();
+ IType t= stmt.getExpression().getExpressionType();
+ assertInstance(t, ICPPReferenceType.class);
+ final long time = System.currentTimeMillis() - now;
+ assertTrue("Lasted " + time + "ms", time < 5000);
+ }
+
// struct A { int a; };
// struct B { int b; };
@@ -7122,7 +7144,7 @@
// foo(L'a');
// }
public void testWideCharacterLiteralTypes_Bug270892() throws Exception {
- IASTTranslationUnit tu = parse( getAboveComment(), ParserLanguage.CPP );
+ IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
@@ -7180,122 +7202,53 @@
parseAndCheckBindings(code, ParserLanguage.CPP);
}
- // int foo(int x);
- // int bar(int x);
+ // typedef enum enum_name enum_name;
+ public void testTypedefRecursion_285457() throws Exception {
+ BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
+ ba.assertProblem("enum_name", 9);
+ }
+
+ // class A {
+ // friend inline void m(A p) {}
+ // };
//
- // typedef int (*fp)(int);
- // struct A {
- // operator fp() { return foo; }
- // } a;
- //
- // int i = bar(a(1)); // problem on bar
- public void testCallToObjectOfClassType_267389() throws Exception {
+ // void test(A a) {
+ // m(a);
+ // }
+ public void _testInlineFriendFunction_284690() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
-
- // typedef int T;
- // class C {
- // C(T); // ctor
- // C(s); // instance s;
- // };
- public void testDeclarationAmbiguity_Bug269953() throws Exception {
- final String code = getAboveComment();
- IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP);
- ICPPASTCompositeTypeSpecifier ct= getCompositeType(tu, 1);
- ICPPClassType c= (ICPPClassType) ct.getName().resolveBinding();
-
- ICPPMethod[] methods= c.getDeclaredMethods();
- assertEquals(1, methods.length);
- assertEquals("C", methods[0].getName());
-
- ICPPField[] fields= c.getDeclaredFields();
- assertEquals(1, fields.length);
- assertEquals("s", fields[0].getName());
- }
-
- // class C3 {
- // C3(int);
- // };
- // typedef C3 T3;
- // T3::C3(int) {
- // }
- public void testCTorWithTypedef_Bug269953() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
- }
-
- // template class Compare {
- // Compare();
- // ~Compare();
- // bool check;
- // };
- // typedef Compare MY_COMPARE;
- // template<> MY_COMPARE::Compare() {}
- public void testTemplateCTorWithTypedef_Bug269953() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
- }
-
- // class IBase {
- // public:
- // virtual void base() = 0;
- // };
+ // void f(int t);
+ // void f(unsigned int t);
+ // void f(long t);
+ //
+ // enum IntEnum { i1 };
+ // enum UnsignedEnum { u1 = 0x7FFFFFFF, u2 };
+ // enum LongEnum { l1 = -1, l2 = 0x7FFFFFFF, l3 };
//
- // class IDerived : virtual public IBase {
- // public:
- // virtual void derived() = 0;
- // };
- //
- // class BaseImplHelper : virtual public IBase {
- // public:
- // virtual void base() {}
- // };
- //
- // class Derived : virtual public IDerived, public BaseImplHelper {
- // public:
- // virtual void derived() {}
- // };
- //
- // int main() {
- // Derived d;
- // d.base(); // Parser log reports ambiguity on 'base'
- // return 0;
+ // void test() {
+ // f(i1);
+ // f(u1);
+ // f(l1);
// }
- public void testHiddenVirtualBase_Bug282993() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
- }
-
- // class C {
- // C& operator()() {return *this;}
- // };
- // void test() {
- // C c;
- // c()()()()()()()()()()()()()();
- // }
- public void testNestedOverloadedFunctionCalls_Bug283324() throws Exception {
- final String code = getAboveComment();
- IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP);
- IASTFunctionDefinition test= getDeclaration(tu, 1);
- IASTExpressionStatement stmt= getStatement(test, 1);
- long now= System.currentTimeMillis();
- IType t= stmt.getExpression().getExpressionType();
- assertInstance(t, ICPPReferenceType.class);
- final long time = System.currentTimeMillis() - now;
- assertTrue("Lasted " + time + "ms", time < 5000);
- }
-
- // class A {
- // friend inline void m(A p1, A p2) {}
- // };
- //
- // void test(A a1, A a2) {
- // m(a1, a2);
- // }
- public void _testInlineFriendFunction_284690() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ public void testEnumToIntConversion_285368() throws Exception {
+ BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
+ ICPPFunction f1 = ba.assertNonProblem("f(i1)", 1, ICPPFunction.class);
+ IType t1 = f1.getType().getParameterTypes()[0];
+ assertTrue(t1 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t1).getType());
+ assertEquals(0, ((ICPPBasicType) t1).getQualifierBits());
+ ICPPFunction f2 = ba.assertNonProblem("f(u1)", 1, ICPPFunction.class);
+ IType t2 = f2.getType().getParameterTypes()[0];
+ assertTrue(t2 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t2).getType());
+ assertEquals(ICPPBasicType.IS_UNSIGNED, ((ICPPBasicType) t2).getQualifierBits());
+ ICPPFunction f3 = ba.assertNonProblem("f(l1)", 1, ICPPFunction.class);
+ IType t3 = f3.getType().getParameterTypes()[0];
+ assertTrue(t3 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t3).getType());
+ assertEquals(ICPPBasicType.IS_LONG, ((ICPPBasicType) t3).getQualifierBits());
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 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
@@ -1203,10 +1203,8 @@
buffer.append("for (int j = 0, k = n*m+300; j < k; j++)\n"); //$NON-NLS-1$
buffer.append("// a is a pointer to a VLA with n*m+300 elements\n"); //$NON-NLS-1$
buffer.append("a[i][j] += x;\n"); //$NON-NLS-1$
- buffer.append("}\n");
- String code = buffer.toString(); //$NON-NLS-1$
- // no valid c++ code
- parse(code, ParserLanguage.C, true, 0);
+ buffer.append("}\n"); //$NON-NLS-1$
+ parseCandCPP(buffer.toString(), true, 0);
}
/**
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java Wed Aug 05 17:35:39 2009 -0500
@@ -1971,7 +1971,8 @@
ICPPSpecialization spec = (ICPPSpecialization) col.getName(9).resolveBinding();
assertSame(spec.getSpecializedBinding(), ctor);
- ICPPParameter c = (ICPPParameter) col.getName(10).resolveBinding();
+ ICPPSpecialization c = (ICPPSpecialization) col.getName(10).resolveBinding();
+ assertSame(c.getSpecializedBinding(), g);
assertSame(blah, col.getName(11).resolveBinding());
assertSame(c, col.getName(12).resolveBinding());
@@ -1979,7 +1980,8 @@
ICPPSpecialization spec2 = (ICPPSpecialization) col.getName(13).resolveBinding();
assertSame(spec.getSpecializedBinding(), ctor);
- ICPPParameter c2 = (ICPPParameter) col.getName(14).resolveBinding();
+ ICPPSpecialization c2 = (ICPPSpecialization) col.getName(14).resolveBinding();
+ assertSame(c2.getSpecializedBinding(), g);
assertSame(blah, col.getName(15).resolveBinding());
assertSame(c2, col.getName(16).resolveBinding());
@@ -2202,6 +2204,7 @@
bh.assertNonProblem("make_pair(1", 9, ICPPFunction.class);
}
+
// template
// struct A {};
//
@@ -4054,7 +4057,7 @@
// void test() {
// S(a);
// }
- public void testFunctionTemplateWithArrayReferenceParameter_269926() throws Exception {
+ public void _testFunctionTemplateWithArrayReferenceParameter_269926() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
@@ -4104,14 +4107,4 @@
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
-
- // template void T(int (&array)[N]) {};
- // void test() {
- // int a[2];
- // T<2>(a);
- // }
- public void testInstantiationOfArraySize_269926() throws Exception {
- final String code= getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
- }
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java Wed Aug 05 17:35:39 2009 -0500
@@ -4008,7 +4008,7 @@
// for plain C this is actually not a problem, the second J has to be interpreted as a (useless)
// parameter name.
assertInstance(typedef, ITypedef.class);
- isTypeEqual(((ITypedef) typedef).getType(), "int (*)(int)");
+ isTypeEqual(((ITypedef) typedef).getType(), "int (int) *");
}
}
}
@@ -5123,19 +5123,19 @@
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (int (*)(int))");
+ isTypeEqual(f.getType(), "int (int (int) *)");
f= ba.assertNonProblem("f2", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (int (*)(int))");
+ isTypeEqual(f.getType(), "int (int (int) *)");
f= ba.assertNonProblem("f3", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (int (*)(int))");
+ isTypeEqual(f.getType(), "int (int (int) *)");
f= ba.assertNonProblem("f4", 2, IFunction.class);
isTypeEqual(f.getType(), "int (int)");
f= ba.assertNonProblem("f5", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (int * (*)(int *))");
+ isTypeEqual(f.getType(), "int (int * (int *) *)");
}
}
@@ -5145,7 +5145,7 @@
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
- isTypeEqual(f.getType(), "void (int (*)(C))");
+ isTypeEqual(f.getType(), "void (int (C) *)");
}
// int (*f1(int par))[5] {};
@@ -5157,10 +5157,10 @@
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp);
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (* (int))[5]");
+ isTypeEqual(f.getType(), "int [] * (int)");
f= ba.assertNonProblem("f1 ", 2, IFunction.class);
- isTypeEqual(f.getType(), "int (* (int))[5]");
+ isTypeEqual(f.getType(), "int [] * (int)");
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/InclusionTests.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/InclusionTests.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/InclusionTests.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 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
@@ -49,7 +49,6 @@
super(name);
}
- @Override
protected void tearDown() throws Exception {
if (fProject != null) {
CProjectHelper.delete(fProject);
@@ -78,36 +77,6 @@
return folder;
}
- // #include "one.h"
- // #include "f1/two.h"
- // #include "f1/f2/three.h"
- public void testIncludeVariables_69529() throws Exception {
- String content= getAboveComment();
-
- IFolder f0 = importFolder(".framework");
- importFolder("f1.framework");
- importFolder("f1");
- importFolder("f1.framework/f2");
- importFolder("f3");
- IFile base = importFile("base.cpp", content);
-
- importFile(".framework/one.h", "1");
- importFile("f1.framework/two.h", "2");
- importFile("f1.framework/f2/three.h", "3");
-
- String[] path = {
- f0.getLocation().removeLastSegments(1) + "/__framework__.framework/__header__"
- };
- IScannerInfo scannerInfo = new ExtendedScannerInfo(Collections.EMPTY_MAP, path, new String[]{}, null);
- CodeReader reader= new CodeReader(base.getLocation().toString());
- initializeScanner(reader, ParserLanguage.C, ParserMode.COMPLETE_PARSE, scannerInfo);
-
- // first file is not picked up (no framework)
- validateInteger("2");
- validateInteger("3");
- validateEOF();
- }
-
public void testIncludeNext() throws Exception {
String baseFile = "int zero; \n#include \"foo.h\""; //$NON-NLS-1$
String i1Next = "int one; \n#include_next "; //$NON-NLS-1$
@@ -210,8 +179,8 @@
CodeReader reader= new CodeReader(base.getLocation().toString());
ParserLanguage lang[]= {ParserLanguage.C, ParserLanguage.CPP};
- for (ParserLanguage element : lang) {
- initializeScanner(reader, element, ParserMode.COMPLETE_PARSE, new ScannerInfo());
+ for (int i = 0; i < lang.length; i++) {
+ initializeScanner(reader, lang[i], ParserMode.COMPLETE_PARSE, new ScannerInfo());
validateToken(IToken.t_int);
validateIdentifier("var");
validateToken(IToken.tASSIGN);
@@ -232,22 +201,4 @@
validateEOF();
}
- // #include
- public void testRelativeIncludes_243170() throws Exception {
- String content= getAboveComment();
-
- IFolder f0 = importFolder("f1");
- importFolder("f1/f2");
- importFolder("f1/f2/inc");
- importFile("f1/f2/inc/test.h", "1");
- IFile base = importFile("f1/base.cpp", getAboveComment());
-
- String[] path = {"f2"}; // relative include
- IScannerInfo scannerInfo = new ExtendedScannerInfo(Collections.EMPTY_MAP, path, new String[]{}, null);
- CodeReader reader= new CodeReader(base.getLocation().toString());
- initializeScanner(reader, ParserLanguage.C, ParserMode.COMPLETE_PARSE, scannerInfo);
-
- validateInteger("1");
- validateEOF();
- }
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2008 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
@@ -88,17 +88,9 @@
}
protected void initializeScanner() throws Exception {
- initializeScanner(getAboveComment());
- }
-
- protected StringBuffer[] getTestContent(int sections) throws IOException {
StringBuffer[] input= TestSourceReader.getContentsForTest(
- CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
- return input;
- }
-
- protected String getAboveComment() throws IOException {
- return getTestContent(1)[0].toString();
+ CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), 1);
+ initializeScanner(input[0].toString());
}
protected void fullyTokenize() throws Exception {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java Wed Aug 05 17:35:39 2009 -0500
@@ -224,13 +224,17 @@
}
protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) {
- assertInstance(conType, ITypeContainer.class);
- assertInstance(conType, containerType);
- IType containedType= ((ITypeContainer)conType).getType();
- assertInstance(containedType, expContainedType);
- if (expContainedTypeQN != null) {
- assertInstance(containedType, IBinding.class);
- assertQNEquals(expContainedTypeQN, (IBinding) containedType);
+ try {
+ assertInstance(conType, ITypeContainer.class);
+ assertInstance(conType, containerType);
+ IType containedType= ((ITypeContainer)conType).getType();
+ assertInstance(containedType, expContainedType);
+ if (expContainedTypeQN != null) {
+ assertInstance(containedType, IBinding.class);
+ assertQNEquals(expContainedTypeQN, (IBinding) containedType);
+ }
+ } catch (DOMException de) {
+ fail(de.getMessage());
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Symbian Software Systems and others.
+ * Copyright (c) 2007, 2008 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
@@ -24,7 +24,6 @@
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
-import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -1364,19 +1363,6 @@
assertNotNull(numericalValue);
assertEquals(i, numericalValue.intValue());
}
-
- // void f(int (&v)[1]);
- // void f(int (&v)[2]);
-
- // void test() {
- // int a[1], b[2];
- // f(a); f(b);
- // }
- public void testArrayTypeWithSize_269926() throws Exception {
- IFunction f1= getBindingFromASTName("f(a)", 1, IFunction.class);
- IFunction f2= getBindingFromASTName("f(b)", 1, IFunction.class);
- assertFalse(f1.equals(f2));
- }
/* CPP assertion helpers */
/* ##################################################################### */
@@ -1470,14 +1456,18 @@
* @param qn may be null
*/
static protected void assertPTM(IType type, String cqn, String qn) {
- assertTrue(type instanceof ICPPPointerToMemberType);
- ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
- ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
- assertQNEquals(cqn, classType);
- if(qn!=null) {
- assert(ptmt.getType() instanceof ICPPBinding);
- ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
- assertQNEquals(qn, tyBinding);
+ try {
+ assertTrue(type instanceof ICPPPointerToMemberType);
+ ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
+ ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
+ assertQNEquals(cqn, classType);
+ if(qn!=null) {
+ assert(ptmt.getType() instanceof ICPPBinding);
+ ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
+ assertQNEquals(qn, tyBinding);
+ }
+ } catch(DOMException de) {
+ fail(de.getMessage());
}
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java Wed Aug 05 17:35:39 2009 -0500
@@ -1597,7 +1597,7 @@
public void testDefaultTemplateArgInHeader_264988() throws Exception {
ICPPTemplateInstance ti= getBindingFromASTName("XT<>", 4, ICPPTemplateInstance.class);
}
-
+
// typedef int TInt;
// template class XT {
// void m();
@@ -1609,76 +1609,6 @@
public void testParentScopeOfSpecialization_267013() throws Exception {
ITypedef ti= getBindingFromASTName("TInt", 4, ITypedef.class);
}
-
- // struct __true_type {};
- // struct __false_type {};
- //
- // template
- // struct __are_same {
- // enum { __value = 0 };
- // typedef __false_type __type;
- // };
- //
- // template
- // struct __are_same<_Tp, _Tp> {
- // enum { __value = 1 };
- // typedef __true_type __type;
- // };
- //
- // template
- // struct __enable_if {};
- //
- // template
- // struct __enable_if {
- // typedef _Tp __type;
- // };
- //
- // template
- // struct __normal_iterator {
- // template
- // __normal_iterator(
- // const __normal_iterator<
- // _Iter,
- // typename __enable_if<
- // __are_same<_Iter, typename _Container::pointer>::__value,
- // _Container
- // >::__type
- // >& __i);
- // };
- //
- // template
- // struct allocator {
- // typedef _Tp* pointer;
- // typedef const _Tp* const_pointer;
- //
- // template
- // struct rebind
- // { typedef allocator<_Tp1> other; };
- // };
- //
- // template >
- // struct vector {
- // typedef vector<_Tp, _Alloc> vector_type;
- // typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
- //
- // typedef typename _Tp_alloc_type::pointer pointer;
- // typedef typename _Tp_alloc_type::const_pointer const_pointer;
- // typedef __normal_iterator iterator;
- // typedef __normal_iterator const_iterator;
- //
- // iterator begin();
- // const_iterator begin() const;
- // };
-
- // void f(vector::const_iterator p);
- //
- // void test() {
- // vector v;
- // f(v.begin());
- // }
- public void testTemplateMetaprogramming_284686() throws Exception {
- getBindingFromASTName("f(v.begin())", 1, ICPPFunction.class);
- }
// template class op {
// public:
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 QNX Software Systems
+ * Copyright (c) 2005, 2008 QNX Software Systems
* 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
@@ -33,7 +33,6 @@
public class DBTest extends BaseTestCase {
protected Database db;
- @Override
protected void setUp() throws Exception {
super.setUp();
db = new Database(getTestDir().append(getName()+System.currentTimeMillis()+".dat").toFile(),
@@ -53,7 +52,6 @@
return path;
}
- @Override
protected void tearDown() throws Exception {
db.close();
if(!db.getLocation().delete()) {
@@ -74,8 +72,8 @@
assertEquals(-blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
db.free(mem);
assertEquals(blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
- assertEquals(mem, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
- assertEquals(mem + blocksize, db.getRecPtr((freeDeltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
+ assertEquals(mem - Database.BLOCK_HEADER_SIZE, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
+ assertEquals(mem - Database.BLOCK_HEADER_SIZE + blocksize, db.getRecPtr((freeDeltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
}
public void testBug192437() throws IOException {
@@ -112,10 +110,10 @@
long mem2 = db.malloc(realsize);
db.free(mem1);
db.free(mem2);
- assertEquals(mem2, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
+ assertEquals(mem2 - Database.BLOCK_HEADER_SIZE, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
assertEquals(0, db.getRecPtr(mem2));
- assertEquals(mem1, db.getRecPtr(mem2 + Database.INT_SIZE));
- assertEquals(mem2, db.getRecPtr(mem1));
+ assertEquals(mem1 - Database.BLOCK_HEADER_SIZE, db.getRecPtr(mem2 + Database.INT_SIZE));
+ assertEquals(mem2 - Database.BLOCK_HEADER_SIZE, db.getRecPtr(mem1));
assertEquals(0, db.getRecPtr(mem1 + Database.INT_SIZE));
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c Wed Aug 05 17:35:39 2009 -0500
@@ -39,11 +39,10 @@
int uid; // quasi-unique process ID; we have to create it to avoid duplicated pid
// (actually this impossible from OS point of view but it is still possible
// a clash of new created and already finished process with one and the same PID.
- // 4 events connected to this process (see starter)
- HANDLE eventBreak; // signaled when Spawner.interrupt() is called; mildest of the terminate requests (SIGINT signal in UNIX world)
+ // 3 events connected to this process (see starter)
+ HANDLE eventBreak;
HANDLE eventWait;
- HANDLE eventTerminate; // signaled when Spawner.terminate() is called; more forceful terminate request (SIGTERM signal in UNIX world)
- HANDLE eventKill; // signaled when Spawner.kill() is called; most forceful terminate request (SIGKILL signal in UNIX world)
+ HANDLE eventTerminate;
} procInfo_t, * pProcInfo_t;
static int procCounter = 0; // Number of running processes
@@ -147,7 +146,6 @@
wchar_t eventBreakName[20];
wchar_t eventWaitName[20];
wchar_t eventTerminateName[20];
- wchar_t eventKillName[20];
#ifdef DEBUG_MONITOR
wchar_t buffer[1000];
#endif
@@ -219,14 +217,14 @@
swprintf(eventBreakName, L"SABreak%p", pCurProcInfo);
swprintf(eventWaitName, L"SAWait%p", pCurProcInfo);
swprintf(eventTerminateName, L"SATerm%p", pCurProcInfo);
- swprintf(eventKillName, L"SAKill%p", pCurProcInfo);
+ pCurProcInfo -> eventBreak = CreateEventW(NULL, TRUE, FALSE, eventBreakName);
+ ResetEvent(pCurProcInfo -> eventBreak);
+ pCurProcInfo -> eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
+ ResetEvent(pCurProcInfo -> eventWait);
+ pCurProcInfo -> eventTerminate = CreateEventW(NULL, TRUE, FALSE, eventTerminateName);
+ ResetEvent(pCurProcInfo -> eventTerminate);
- pCurProcInfo->eventBreak = CreateEventW(NULL, FALSE, FALSE, eventBreakName);
- pCurProcInfo->eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
- pCurProcInfo->eventTerminate = CreateEventW(NULL, FALSE, FALSE, eventTerminateName);
- pCurProcInfo->eventKill = CreateEventW(NULL, FALSE, FALSE, eventKillName);
-
- swprintf(szCmdLine, L"\"%sstarter.exe\" %i %i %s %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName, eventKillName);
+ swprintf(szCmdLine, L"\"%sstarter.exe\" %i %i %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName);
nPos = wcslen(szCmdLine);
// Prepare command line
@@ -669,34 +667,22 @@
// Temporary do nothing
ret = 0;
break;
+ case SIG_KILL:
case SIG_TERM:
#ifdef DEBUG_MONITOR
- swprintf(buffer, _T("Spawner received TERM signal for process %i\n"),
+ swprintf(buffer, _T("Spawner received KILL or TERM signal for process %i\n"),
pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
SetEvent(pCurProcInfo -> eventTerminate);
#ifdef DEBUG_MONITOR
- OutputDebugStringW(_T("Spawner signalled TERM event\n"));
-#endif
- ret = 0;
- break;
-
- case SIG_KILL:
-#ifdef DEBUG_MONITOR
- swprintf(buffer, _T("Spawner received KILL signal for process %i\n"),
- pCurProcInfo -> pid);
- OutputDebugStringW(buffer);
-#endif
- SetEvent(pCurProcInfo -> eventKill);
-#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Spawner signalled KILL event\n"));
#endif
ret = 0;
break;
case SIG_INT:
ResetEvent(pCurProcInfo -> eventWait);
- SetEvent(pCurProcInfo -> eventBreak);
+ PulseEvent(pCurProcInfo -> eventBreak);
ret = (WaitForSingleObject(pCurProcInfo -> eventWait, 100) == WAIT_OBJECT_0);
break;
default:
@@ -855,12 +841,6 @@
pCurProcInfo -> eventTerminate = 0;
}
- if(0 != pCurProcInfo -> eventKill)
- {
- CloseHandle(pCurProcInfo -> eventKill);
- pCurProcInfo -> eventKill = 0;
- }
-
pCurProcInfo -> pid = 0;
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/starter/starter.cpp
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/starter/starter.cpp Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/library/starter/starter.cpp Wed Aug 05 17:35:39 2009 -0500
@@ -139,8 +139,8 @@
wchar_t ** argv = CommandLineToArgvW(GetCommandLine(), &argc);
// Make sure that we've been passed the right number of arguments
- if (argc < 8) {
- _tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"),
+ if (argc < 7) {
+ _tprintf(_T("Usage: %s (Three InheritableEventHandles) (CommandLineToSpawn)\n"),
argv[0]);
return(0);
}
@@ -151,7 +151,7 @@
szCmdLine[0]= 0;
int nPos = 0;
- for(int i = 7; i < argc; ++i)
+ for(int i = 6; i < argc; ++i)
{
int nCpyLen;
int len= wcslen(argv[i]);
@@ -192,11 +192,9 @@
BOOL exitProc = FALSE;
HANDLE waitEvent = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[4]);
- HANDLE h[4];
- h[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]); // simulated SIGINT
-// h[1] we reserve for the process handle
- h[2] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[5]); // simulated SIGTERM
- h[3] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[6]); // simulated SIGKILL
+ HANDLE h[3];
+ h[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]);
+ h[2] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[5]); // This is a terminate event
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
int parentPid = wcstol(argv[1], NULL, 10);
@@ -308,10 +306,9 @@
{
// Wait for the spawned-process to die or for the event
// indicating that the processes should be forcibly killed.
- DWORD event = WaitForMultipleObjects(4, h, FALSE, INFINITE);
- switch (event)
+ switch (WaitForMultipleObjects(3, h, FALSE, INFINITE))
{
- case WAIT_OBJECT_0 + 0: // SIGINT
+ case WAIT_OBJECT_0 + 0: // Send Ctrl-C
#ifdef DEBUG_MONITOR
swprintf(buffer, _T("starter (PID %i) received CTRL-C event\n"), currentPID);
OutputDebugStringW(buffer);
@@ -341,23 +338,16 @@
GetExitCodeProcess(pi.hProcess, &dwExitCode);
exitProc = TRUE;
break;
-
- // Terminate and Kill behavior differ only for cygwin processes, where
- // we use the cygwin 'kill' command. We send a SIGKILL in one case,
- // SIGTERM in the other. For non-cygwin processes, both requests
- // are treated exactly the same
- case WAIT_OBJECT_0 + 2: // TERM
- case WAIT_OBJECT_0 + 3: // KILL
- {
- const wchar_t* signal = (event == WAIT_OBJECT_0 + 2) ? L"TERM" : L"KILL";
+
+ case WAIT_OBJECT_0 + 2: // Kill
#ifdef DEBUG_MONITOR
- swprintf(buffer, _T("starter received %s event (PID %i)\n"), signal, currentPID);
+ swprintf(buffer, _T("starter received KILL event (PID %i)\n"), currentPID);
OutputDebugStringW(buffer);
#endif
if (isCygwin(h[1])) {
// Need to issue a kill command
wchar_t kill[1024];
- swprintf(kill, L"kill -%s %d", signal, pi.dwProcessId);
+ swprintf(kill, L"kill -SIGTERM %d", pi.dwProcessId);
if (!runCygwinCommand(kill)) {
// fall back to console event
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
@@ -375,13 +365,10 @@
DisplayErrorMessage();
#endif
}
- }
-
- // Note that we keep trucking until the child process terminates (case WAIT_OBJECT_0 + 1)
+ } else
+ exitProc = TRUE;
break;
- }
-
- default:
+ default:
// Unexpected code
#ifdef DEBUG_MONITOR
DisplayErrorMessage();
@@ -391,6 +378,7 @@
}
}
+ CloseHandle(pi.hProcess);
} else {
#ifdef DEBUG_MONITOR
swprintf(buffer, _T("Cannot start: %s\n"), szCmdLine);
@@ -409,7 +397,6 @@
CloseHandle(h[0]);
CloseHandle(h[1]);
CloseHandle(h[2]);
- CloseHandle(h[3]);
return(dwExitCode);
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll
Binary file cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll has changed
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe
Binary file cdt/cdt_6_0_x/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe has changed
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/META-INF/MANIFEST.MF
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/META-INF/MANIFEST.MF Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/META-INF/MANIFEST.MF Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
-Bundle-Version: 5.2.0.qualifier
+Bundle-Version: 5.1.1.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/CElementBaseLabels.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/CElementBaseLabels.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/CElementBaseLabels.java Wed Aug 05 17:35:39 2009 -0500
@@ -33,7 +33,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
/**
* Creates labels for ICElement objects.
@@ -759,14 +758,7 @@
if (rootQualified) {
buf.append(container.getPath().makeRelative().toString());
} else {
- if (CCorePlugin.showSourceRootsAtTopOfProject()) {
- buf.append(container.getElementName());
- }
- else {
- String elementName = container.getElementName();
- IPath path = new Path(elementName);
- buf.append(path.lastSegment());
- }
+ buf.append(container.getElementName());
if (getFlag(flags, ROOT_QUALIFIED)) {
if (resource != null && container instanceof ISourceRoot && isReferenced((ISourceRoot)container)) {
buf.append(CONCAT_STRING);
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -93,18 +93,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((fSourceAttachmentPath == null) ? 0 : fSourceAttachmentPath.hashCode());
- result = prime * result
- + ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode());
- result = prime * result
- + ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode());
- return result;
- }
-
- @Override
public boolean equals(Object other) {
if(other == this)
return true;
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/APathEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -81,16 +81,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((basePath == null) ? 0 : basePath.hashCode());
- result = prime * result + ((baseRef == null) ? 0 : baseRef.hashCode());
- result = prime * result + Arrays.hashCode(exclusionPatterns);
- return result;
- }
-
- @Override
public boolean equals(Object obj) {
if (obj instanceof APathEntry) {
APathEntry otherEntry = (APathEntry)obj;
@@ -135,6 +125,16 @@
return super.equals(obj);
}
+ @Override
+ public int hashCode() {
+ int hashCode = Arrays.hashCode(exclusionPatterns);
+ if (basePath != null)
+ hashCode += basePath.hashCode();
+ if (baseRef != null)
+ hashCode += baseRef.hashCode();
+ return hashCode + super.hashCode();
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -150,5 +150,4 @@
}
return sb.toString();
}
-
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
+ * Copyright (c) 2002, 2009 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
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -49,16 +49,6 @@
return isSystemInclude;
}
-@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((includePath == null) ? 0 : includePath.hashCode());
- result = prime * result + (isSystemInclude ? 1231 : 1237);
- return result;
- }
-
@Override
public boolean equals(Object obj) {
if (obj instanceof IIncludeEntry) {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeFileEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeFileEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeFileEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -41,16 +41,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((includeFilePath == null) ? 0 : includeFilePath.hashCode());
- return result;
- }
-
-
- @Override
public boolean equals(Object obj) {
if (obj instanceof IIncludeFileEntry) {
IIncludeFileEntry otherEntry = (IIncludeFileEntry) obj;
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -133,17 +133,6 @@
return super.equals(obj);
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((libraryPath == null) ? 0 : libraryPath.hashCode());
- result = prime * result + ((sourceAttachmentPath == null) ? 0 : sourceAttachmentPath.hashCode());
- result = prime * result
- + ((sourceAttachmentRootPath == null) ? 0 : sourceAttachmentRootPath.hashCode());
- return result;
- }
-
public IPath getFullLibraryPath() {
IPath p;
IPath lib = getLibraryPath();
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -45,17 +45,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((macroName == null) ? 0 : macroName.hashCode());
- result = prime * result
- + ((macroValue == null) ? 0 : macroValue.hashCode());
- return result;
- }
-
- @Override
public boolean equals(Object obj) {
if (obj instanceof IMacroEntry) {
IMacroEntry otherEntry = (IMacroEntry)obj;
@@ -85,6 +74,11 @@
return super.equals(obj);
}
+ @Override
+ public int hashCode() {
+ return macroName.hashCode() + macroValue.hashCode() + super.hashCode();
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroFileEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroFileEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroFileEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -40,15 +40,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((macroFilePath == null) ? 0 : macroFilePath.hashCode());
- return result;
- }
-
- @Override
public boolean equals(Object obj) {
if (obj instanceof IMacroFileEntry) {
IMacroFileEntry otherEntry = (IMacroFileEntry) obj;
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java Wed Aug 05 17:35:39 2009 -0500
@@ -73,12 +73,7 @@
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + entryKind;
- result = prime * result + (isExported ? 1231 : 1237);
- result = prime * result + ((path == null) ? 0 : path.hashCode());
- return result;
+ return path.hashCode() + entryKind * 17 + (isExported ? 3 : 2);
}
/**
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java Wed Aug 05 17:35:39 2009 -0500
@@ -12,12 +12,9 @@
package org.eclipse.cdt.internal.core.model;
import java.io.File;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CModelException;
@@ -338,17 +335,17 @@
public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
// Check duplication.
- Set entrySet = new HashSet(entries.length);
for (IPathEntry entry : entries) {
- if (entry != null) {
- if (entrySet.contains(entry)) {
- return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY,
- MessageFormat.format("{0}{1}", //$NON-NLS-1$
- CCorePlugin.getResourceString("CoreModel.PathEntry.DuplicateEntry"), //$NON-NLS-1$
- entry.getPath().toString()));
+ if (entry == null) {
+ continue;
+ }
+ for (IPathEntry otherEntry : entries) {
+ if (otherEntry == null) {
+ continue;
}
- else {
- entrySet.add(entry);
+ if (entry != otherEntry && otherEntry.equals(entry)) {
+ StringBuffer errMesg = new StringBuffer(CCorePlugin.getResourceString("CoreModel.PathEntry.DuplicateEntry")); //$NON-NLS-1$
+ return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString());
}
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java Wed Aug 05 17:35:39 2009 -0500
@@ -1793,15 +1793,14 @@
newEntries = EMPTY_LANGUAGE_SETTINGS_ENTRIES_ARRAY;
}
- Set newEntrySet = new HashSet(Arrays.asList(newEntries));
- Set oldEntrySet = new HashSet(Arrays.asList(oldEntries));
-
// Check the removed entries.
- for (ICLanguageSettingEntry oldEntry : oldEntries) {
+ for (int i = 0; i < oldEntries.length; i++) {
boolean found = false;
- if (newEntrySet.contains(oldEntry)) {
- found = true;
- break;
+ for (int j = 0; j < newEntries.length; j++) {
+ if (oldEntries[i].equals(newEntries[j])) {
+ found = true;
+ break;
+ }
}
if(!found){
result[1] = true;
@@ -1810,11 +1809,13 @@
}
// Check the new entries.
- for (ICLanguageSettingEntry newEntry : newEntries) {
+ for (int i = 0; i < newEntries.length; i++) {
boolean found = false;
- if (oldEntrySet.contains(newEntry)) {
- found = true;
- break;
+ for (int j = 0; j < oldEntries.length; j++) {
+ if (newEntries[i].equals(oldEntries[j])) {
+ found = true;
+ break;
+ }
}
if(!found){
result[0] = true;
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Intel Corporation and others.
+ * Copyright (c) 2007 Intel 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
@@ -33,7 +33,6 @@
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingBase;
-import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -45,7 +44,7 @@
private IProject fProject;
private ICProjectDescription fProjDes;
private ICConfigurationDescription fCfgDes;
- private Map
+
\ No newline at end of file
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF Wed Aug 05 17:35:39 2009 -0500
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson 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:
- * Ericsson - initial implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.gdb;
-
-import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
-
-
-
-/**
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface IGdbDebugPreferenceConstants {
-
- /**
- * Boolean preference whether to enable GDB traces. Default is true.
- */
- public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
-
- /**
- * Boolean preference whether to automatically terminate GDB when the inferior exists. Default is true.
- */
- public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
-
- /**
- * Help prefixes.
- */
- public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
-
- public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
-}
-
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson 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:
+ * Ericsson - initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.gdb;
+
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
+
+
+
+/**
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
+ */
+public interface IGdbDebugPreferenceConstants {
+
+ /**
+ * Boolean preference whether to enable GDB traces. Default is true.
+ */
+ public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference whether to automatically terminate GDB when the inferior exists. Default is true.
+ */
+ public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
+
+ /**
+ * Help prefixes.
+ */
+ public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
+
+ public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
+}
+
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java Wed Aug 05 17:35:39 2009 -0500
@@ -38,11 +38,10 @@
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetArgs;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
-import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath;
-import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetAsync;
import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelect;
import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore;
+import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.core.runtime.CoreException;
@@ -222,12 +221,12 @@
if (isNonStop) {
// The raw commands should not be necessary in the official GDB release
fCommandControl.queueCommand(
- new MIGDBSetTargetAsync(fCommandControl.getContext(), true),
+ new RawCommand(fCommandControl.getContext(), "set target-async on"), //$NON-NLS-1$
new DataRequestMonitor(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
fCommandControl.queueCommand(
- new MIGDBSetPagination(fCommandControl.getContext(), false),
+ new RawCommand(fCommandControl.getContext(), "set pagination off"), //$NON-NLS-1$
new DataRequestMonitor(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java Wed Aug 05 17:35:39 2009 -0500
@@ -34,7 +34,6 @@
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
import org.eclipse.cdt.dsf.mi.service.MIRunControl;
import org.eclipse.cdt.dsf.mi.service.MIStack;
-import org.eclipse.cdt.dsf.mi.service.command.commands.CLIRecord;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert;
import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand;
@@ -45,6 +44,7 @@
import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStep;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStepInstruction;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUncall;
+import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand;
import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
@@ -424,15 +424,27 @@
return;
}
- getConnection().queueCommand(
- new CLIRecord(context, enable),
- new DataRequestMonitor(getExecutor(), rm) {
- @Override
- public void handleSuccess() {
- setReverseModeEnabled(enable);
- rm.done();
- }
- });
+ if (enable) {
+ getConnection().queueCommand(
+ new RawCommand(context, "record"), //$NON-NLS-1$
+ new DataRequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ setReverseModeEnabled(true);
+ rm.done();
+ }
+ });
+ } else {
+ getConnection().queueCommand(
+ new RawCommand(context, "record stop"), //$NON-NLS-1$
+ new DataRequestMonitor(getExecutor(), rm) {
+ @Override
+ public void handleSuccess() {
+ setReverseModeEnabled(false);
+ rm.done();
+ }
+ });
+ }
}
/** @since 2.0 */
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java Wed Aug 05 17:35:39 2009 -0500
@@ -44,7 +44,6 @@
import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackSelectFrame;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadSelect;
-import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand;
import org.eclipse.cdt.dsf.mi.service.command.output.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIList;
@@ -68,8 +67,6 @@
public abstract class AbstractMIControl extends AbstractDsfService
implements ICommandControlService
{
- private static final String MI_TRACE_IDENTIFIER = " [MI] "; //$NON-NLS-1$
-
/*
* Thread control variables for the transmit and receive threads.
*/
@@ -320,12 +317,7 @@
}
}
- if (!(handle.getCommand() instanceof RawCommand)) {
- // Only generate a token id if the command is not a RawCommand
- // RawCommands are sent to GDB without an answer expected, so we don't
- // need a token id. In fact, GDB will fail if we send one in this case.
- handle.generateTokenId();
- }
+ handle.generateTokenId();
fTxCommands.add(handle);
}
}
@@ -536,10 +528,7 @@
/*
* We note that this is an outstanding request at this point.
*/
- if (!(commandHandle.getCommand() instanceof RawCommand)) {
- // RawCommands will not get an answer, so we cannot put them in the receive queue.
- fRxCommands.put(commandHandle.getTokenId(), commandHandle);
- }
+ fRxCommands.put(commandHandle.getTokenId(), commandHandle);
}
/*
@@ -551,9 +540,6 @@
if (fUseThreadAndFrameOptions && commandHandle.getCommand().supportsThreadAndFrameOptions()) {
str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(),
commandHandle.getStackFrameId());
- } else if (commandHandle.getCommand() instanceof RawCommand) {
- // RawCommands CANNOT have a token id: GDB would read it as part of the RawCommand!
- str = commandHandle.getCommand().constructCommand();
} else {
str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand();
}
@@ -563,7 +549,7 @@
fOutputStream.write(str.getBytes());
fOutputStream.flush();
- GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + str);
+ GdbPlugin.debug(GdbPlugin.getDebugTime() + " " + str); //$NON-NLS-1$
getExecutor().execute(new DsfRunnable() {
public void run() {
if (getMITracingStream() != null) {
@@ -615,7 +601,7 @@
String line;
while ((line = reader.readLine()) != null) {
if (line.length() != 0) {
- GdbPlugin.debug(GdbPlugin.getDebugTime() + MI_TRACE_IDENTIFIER + line + "\n"); //$NON-NLS-1$
+ GdbPlugin.debug(GdbPlugin.getDebugTime() + " " + line +"\n"); //$NON-NLS-1$ //$NON-NLS-2$
final String finalLine = line;
getExecutor().execute(new DsfRunnable() {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson 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:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.mi.service.command.commands;
-
-import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
-import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
-
-/**
- * This command turns on on off the recording of "Process Record and Replay".
- *
- * @since 2.1
- */
-public class CLIRecord extends CLICommand {
- public CLIRecord(ICommandControlDMContext ctx, boolean enable) {
- super(ctx, enable ? "record" : "record stop"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaCommand.java Wed Aug 05 17:35:39 2009 -0500
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
-import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
-import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
@@ -54,13 +52,7 @@
@Override
public String toString() {
- IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(fCtx, IExpressionDMContext.class);
- if (exprDmc != null) {
- return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
- exprDmc.getExpression() + "\")"; //$NON-NLS-1$
- } else {
- return getClass().getName() + (fCtx == null ? "null" : fCtx.toString()); //$NON-NLS-1$
- }
+ return getClass().getName() + (fCtx == null ? "null" : fCtx.toString()); //$NON-NLS-1$
}
public String getCommandControlFilter() {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/ExprMetaGetValue.java Wed Aug 05 17:35:39 2009 -0500
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
-import org.eclipse.cdt.dsf.datamodel.DMContexts;
-import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetValueInfo;
@@ -20,16 +18,4 @@
public ExprMetaGetValue(FormattedValueDMContext ctx) {
super(ctx);
}
-
- @Override
- public String toString() {
- IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getContext(), IExpressionDMContext.class);
- if (exprDmc != null) {
- return getClass().getSimpleName() + "(\"" + //$NON-NLS-1$
- exprDmc.getExpression() + "\", " + //$NON-NLS-1$
- ((FormattedValueDMContext)getContext()).getFormatID() + ")"; //$NON-NLS-1$
- } else {
- return super.toString();
- }
- }
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java Wed Aug 05 17:35:39 2009 -0500
@@ -37,8 +37,8 @@
}
/**
- * @since 2.1
- */
+ * @since 2.0
+ */
public MIExecContinue(IExecutionDMContext dmc, String groupId) {
this(dmc, false, groupId);
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java Wed Aug 05 17:35:39 2009 -0500
@@ -42,8 +42,8 @@
}
/**
- * @since 2.1
- */
+ * @since 2.0
+ */
public MIExecInterrupt(IExecutionDMContext dmc, String groupId) {
this(dmc, false, groupId);
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson 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:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.mi.service.command.commands;
-
-import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
-
-/**
- *
- * -gdb-set pagination [on | off]
- *
- * @since 2.1
- */
-public class MIGDBSetPagination extends MIGDBSet
-{
- public MIGDBSetPagination(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"pagination", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson 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:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.mi.service.command.commands;
-
-import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
-
-/**
- *
- * -gdb-set target-async [on | off]
- *
- * @since 2.1
- */
-public class MIGDBSetTargetAsync extends MIGDBSet
-{
- public MIGDBSetTargetAsync(ICommandControlDMContext ctx, boolean isSet) {
- super(ctx, new String[] {"target-async", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetAttributesInfo.java Wed Aug 05 17:35:39 2009 -0500
@@ -26,9 +26,4 @@
public V getSubsetResult(ICommand command) {
return null;
}
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " (" + getEditable() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
}
\ No newline at end of file
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildCountInfo.java Wed Aug 05 17:35:39 2009 -0500
@@ -26,9 +26,4 @@
public V getSubsetResult(ICommand command) {
return null;
}
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " (" + getChildNum() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
}
\ No newline at end of file
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetChildrenInfo.java Wed Aug 05 17:35:39 2009 -0500
@@ -27,11 +27,4 @@
public V getSubsetResult(ICommand command) {
return null;
}
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " [Array of " + //$NON-NLS-1$
- (getChildrenExpressions() == null ? 0 : getChildrenExpressions().length) +
- " children]"; //$NON-NLS-1$
- }
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetValueInfo.java Wed Aug 05 17:35:39 2009 -0500
@@ -26,9 +26,4 @@
public V getSubsetResult(ICommand command) {
return null;
}
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " (" + getValue() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
}
\ No newline at end of file
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/ExprMetaGetVarInfo.java Wed Aug 05 17:35:39 2009 -0500
@@ -35,11 +35,4 @@
public V getSubsetResult(ICommand command) {
return null;
}
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " (" + //$NON-NLS-1$
- getExpr() + ", " + getNumChildren() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
- getType() + ", " + getEditable() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/META-INF/MANIFEST.MF
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/META-INF/MANIFEST.MF Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/META-INF/MANIFEST.MF Wed Aug 05 17:35:39 2009 -0500
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.ui;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.0.1.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/memory/RefreshAction.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/memory/RefreshAction.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/memory/RefreshAction.java Wed Aug 05 17:35:39 2009 -0500
@@ -15,9 +15,9 @@
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.internal.ui.views.memory.MemoryView;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
+import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -33,10 +33,10 @@
private IMemoryBlock fMemoryBlock = null;
- private MemoryView fView;
+ private IMemoryRenderingSite fsite;
public void init(IViewPart view) {
- fView = (MemoryView) view;
+ fsite = (IMemoryRenderingSite) view;
}
public void run(IAction action) {
@@ -44,7 +44,7 @@
if(fMemoryBlock instanceof IMemoryBlockUpdatePolicyProvider)
{
((IMemoryBlockUpdatePolicyProvider) fMemoryBlock).clearCache();
- IMemoryRenderingContainer containers[] = fView.getMemoryRenderingContainers();
+ IMemoryRenderingContainer containers[] = fsite.getMemoryRenderingContainers();
for(int i = 0; i < containers.length; i++)
{
IMemoryRendering renderings[] = containers[i].getRenderings();
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf/.options
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/.options Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/.options Wed Aug 05 17:35:39 2009 -0500
@@ -1,4 +1,3 @@
org.eclipse.cdt.dsf/debug = false
org.eclipse.cdt.dsf/debug/executor = false
org.eclipse.cdt.dsf/debug/executorName =
-org.eclipse.cdt.dsf/debugCache = false
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DsfExecutable.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DsfExecutable.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DsfExecutable.java Wed Aug 05 17:35:39 2009 -0500
@@ -26,7 +26,7 @@
*
* @since 1.0
*/
-@ThreadSafe
+@Immutable
public class DsfExecutable {
/**
* Flag indicating that tracing of the DSF executor is enabled. It enables
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java Wed Aug 05 17:35:39 2009 -0500
@@ -40,13 +40,13 @@
* 2. the method is executed by a subsystem
* 3. when the method is finished it calls another method and passes
* the original callback to it
- * 4. steps 2-3 are repeated a number of times
+ * 4. steps 2-3 are repeated number of times
* 5. when the last method in a chain is executed, it submits the original
* RequestMonitor callback
*
*
* This pattern is very useful in itself, but it proves very difficult to follow
- * because the methods can be scattered across many classes and systems. Also
+ * because the methods can be scattered accross many classes and systems. Also
* if progress reporting, cancellability, and roll-back ability is required, it
* has to be re-implemented every time. The Sequence class tries to address
* this problem by containing this pattern in a single class.
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java Wed Aug 05 17:35:39 2009 -0500
@@ -28,7 +28,6 @@
import org.eclipse.cdt.dsf.internal.DsfPlugin;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
/**
@@ -159,56 +158,6 @@
private ArrayList fPendingQWaitingForCoalescedCompletion = new ArrayList();
- private static boolean DEBUG = false;
- private static final String CACHE_TRACE_IDENTIFIER = " [CHE]"; //$NON-NLS-1$
- private static String BLANK_CACHE_TRACE_IDENTIFIER = ""; //$NON-NLS-1$
- static {
- DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.cdt.dsf/debugCache")); //$NON-NLS-1$//$NON-NLS-2$
- for (int i=0; i 100) {
- String partial = message.substring(0, 100) + "\\"; //$NON-NLS-1$
- message = message.substring(100);
- System.out.println(partial);
- }
- System.out.println(message);
- }
- }
- }
-
public CommandCache(DsfSession session, ICommandControl control) {
fSession = session;
fCommandControl = control;
@@ -307,15 +256,12 @@
*/
if(fCachedContexts.get(context) != null && fCachedContexts.get(context).containsKey(cachedCmd)){
CommandResultInfo result = fCachedContexts.get(context).get(cachedCmd);
- debug(command.toString().trim());
if (result.getStatus().getSeverity() <= IStatus.INFO) {
@SuppressWarnings("unchecked")
V v = (V)result.getData();
rm.setData(v);
- debug(v.toString());
} else {
rm.setStatus(result.getStatus());
- debug(result.getStatus().toString());
}
rm.done();
return;
@@ -325,8 +271,6 @@
* Return an error if the target is available anymore.
*/
if (!isTargetAvailable(command.getContext())) {
- debug(command.toString().trim(), "[N/A]"); //$NON-NLS-1$
-
rm.setStatus(new Status(IStatus.ERROR, DsfPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Target not available.", null)); //$NON-NLS-1$
rm.done();
return;
@@ -339,14 +283,12 @@
for ( CommandInfo sentCommand : fPendingQCommandsSent ) {
if ( sentCommand.equals( cachedCmd )) {
sentCommand.getRequestMonitorList().add(genericDone);
- debug(command.toString().trim(), "[SNT]"); //$NON-NLS-1$
return;
}
}
for ( CommandInfo notYetSentCommand : fPendingQCommandsNotYetSent ) {
if ( notYetSentCommand.equals( cachedCmd )) {
notYetSentCommand.getRequestMonitorList().add(genericDone);
- debug(command.toString().trim(), "[SND]"); //$NON-NLS-1$
return;
}
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/.cvsignore
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/.cvsignore Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-bin
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java Wed Aug 05 17:35:39 2009 -0500
@@ -10,14 +10,43 @@
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepOverCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepReturnCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfSuspendCommand;
+import org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.pda.PDAPlugin;
import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch;
+import org.eclipse.cdt.examples.dsf.pda.ui.actions.PDATerminateCommand;
+import org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.PDAVMAdapter;
import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.core.commands.IResumeHandler;
+import org.eclipse.debug.core.commands.IStepIntoHandler;
+import org.eclipse.debug.core.commands.IStepOverHandler;
+import org.eclipse.debug.core.commands.IStepReturnHandler;
+import org.eclipse.debug.core.commands.ISuspendHandler;
+import org.eclipse.debug.core.commands.ITerminateHandler;
+import org.eclipse.debug.core.model.IDebugModelProvider;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
-import org.eclipse.debug.ui.contexts.ISuspendTrigger;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
+import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
/**
* The adapter factory is the central point of control of view model and other
@@ -32,8 +61,146 @@
*/
@ThreadSafe
@SuppressWarnings({"restriction"})
-public class PDAAdapterFactory implements IAdapterFactory
+public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
{
+ /**
+ * Contains the set of adapters that are created for each launch instance.
+ */
+ @Immutable
+ private static class LaunchAdapterSet {
+ // View Model adapter
+ final PDAVMAdapter fViewModelAdapter;
+
+ // Source lookup and positioning adapter
+ final DsfSourceDisplayAdapter fSourceDisplayAdapter;
+
+ // Command adapters
+ final DsfStepIntoCommand fStepIntoCommand;
+ final DsfStepOverCommand fStepOverCommand;
+ final DsfStepReturnCommand fStepReturnCommand;
+ final DsfSuspendCommand fSuspendCommand;
+ final DsfResumeCommand fResumeCommand;
+ final PDATerminateCommand fTerminateCommand;
+
+ // Adapters for integration with other UI actions
+ final IDebugModelProvider fDebugModelProvider;
+ final PDALaunch fLaunch;
+
+ final SteppingController fSteppingController;
+
+ private IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
+
+ LaunchAdapterSet(PDALaunch launch) {
+ // Initialize launch and session.
+ fLaunch = launch;
+ DsfSession session = launch.getSession();
+
+ // register stepping controller
+ fSteppingController = new SteppingController(session);
+ session.registerModelAdapter(SteppingController.class, fSteppingController);
+
+ // Initialize VM
+ fViewModelAdapter = new PDAVMAdapter(session, fSteppingController);
+
+ // Initialize source lookup
+ fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController);
+ session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
+
+ // Default selection policy
+ fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
+ session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
+
+ // Initialize retargetable command handler.
+ fStepIntoCommand = new DsfStepIntoCommand(session, null);
+ fStepOverCommand = new DsfStepOverCommand(session, null);
+ fStepReturnCommand = new DsfStepReturnCommand(session);
+ fSuspendCommand = new DsfSuspendCommand(session);
+ fResumeCommand = new DsfResumeCommand(session);
+ fTerminateCommand = new PDATerminateCommand(session);
+ session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
+ session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
+ session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
+ session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
+ session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
+ session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
+
+ // Initialize debug model provider
+ fDebugModelProvider = new IDebugModelProvider() {
+ public String[] getModelIdentifiers() {
+ return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL };
+ }
+ };
+ session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
+
+ // Register the launch as an adapter This ensures that the launch,
+ // and debug model ID will be associated with all DMContexts from this
+ // session.
+ session.registerModelAdapter(ILaunch.class, fLaunch);
+ }
+
+ void dispose() {
+ DsfSession session = fLaunch.getSession();
+
+ fViewModelAdapter.dispose();
+
+ session.unregisterModelAdapter(ISourceDisplay.class);
+ if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
+
+ session.unregisterModelAdapter(SteppingController.class);
+ fSteppingController.dispose();
+
+ session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
+
+ session.unregisterModelAdapter(IStepIntoHandler.class);
+ session.unregisterModelAdapter(IStepOverHandler.class);
+ session.unregisterModelAdapter(IStepReturnHandler.class);
+ session.unregisterModelAdapter(ISuspendHandler.class);
+ session.unregisterModelAdapter(IResumeHandler.class);
+ session.unregisterModelAdapter(ITerminateHandler.class);
+ fStepIntoCommand.dispose();
+ fStepOverCommand.dispose();
+ fStepReturnCommand.dispose();
+ fSuspendCommand.dispose();
+ fResumeCommand.dispose();
+ fTerminateCommand.dispose();
+ }
+ }
+
+ /**
+ * Active adapter sets. They are accessed using the launch instance
+ * which owns the debug services session.
+ */
+ private static Map fgLaunchAdapterSets =
+ Collections.synchronizedMap(new HashMap());
+
+ /**
+ * Map of launches for which adapter sets have already been disposed.
+ * This map (used as a set) is maintained in order to avoid re-creating an
+ * adapter set after the launch was removed from the launch manager, but
+ * while the launch is still being held by other classes which may
+ * request its adapters. A weak map is used to avoid leaking
+ * memory once the launches are no longer referenced.
+ *
+ * Access to this map is synchronized using the fgLaunchAdapterSets
+ * instance.
+ *
+ */
+ private static Map fgDisposedLaunchAdapterSets =
+ new WeakHashMap();
+
+ static void disposeAdapterSet(ILaunch launch) {
+ synchronized(fgLaunchAdapterSets) {
+ if ( fgLaunchAdapterSets.containsKey(launch) ) {
+ fgLaunchAdapterSets.remove(launch).dispose();
+ fgDisposedLaunchAdapterSets.put(launch, null);
+ }
+ }
+ }
+
+ public PDAAdapterFactory() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
// This IAdapterFactory method returns adapters for the PDA launch object only.
@SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
public Object getAdapter(Object adaptableObject, Class adapterType) {
@@ -48,12 +215,26 @@
DsfSession session = launch.getSession();
if (session == null) return null;
- SessionAdapterSet adapterSet = PDAUIPlugin.getDefault().getAdapterSet(launch);
+ // Find the correct set of adapters based on the launch. If not found
+ // it means that we have a new launch, and we have to create a
+ // new set of adapters.
+ LaunchAdapterSet adapterSet;
+ synchronized(fgLaunchAdapterSets) {
+ // The adapter set for the given launch was already disposed.
+ // Return a null adapter.
+ if (fgDisposedLaunchAdapterSets.containsKey(launch)) {
+ return null;
+ }
+ adapterSet = fgLaunchAdapterSets.get(launch);
+ if (adapterSet == null) {
+ adapterSet = new LaunchAdapterSet(launch);
+ fgLaunchAdapterSets.put(launch, adapterSet);
+ }
+ }
// Returns the adapter type for the launch object.
if (adapterType.equals(IElementContentProvider.class)) return adapterSet.fViewModelAdapter;
else if (adapterType.equals(IModelProxyFactory.class)) return adapterSet.fViewModelAdapter;
- else if (adapterType.equals(ISuspendTrigger.class)) return adapterSet.fSuspendTrigger;
else return null;
}
@@ -62,4 +243,24 @@
return new Class[] { IElementContentProvider.class, IModelProxyFactory.class, IColumnPresentationFactory.class };
}
+ public void launchesRemoved(ILaunch[] launches) {
+ // Dispose the set of adapters for a launch only after the launch is
+ // removed from the view. If the launch is terminated, the adapters
+ // are still needed to populate the contents of the view.
+ for (ILaunch launch : launches) {
+ if (launch instanceof PDALaunch) {
+ disposeAdapterSet(launch);
+ }
+ }
+ }
+
+ public void launchesTerminated(ILaunch[] launches) {
+ }
+
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java Wed Aug 05 17:35:39 2009 -0500
@@ -13,16 +13,12 @@
package org.eclipse.cdt.examples.dsf.pda.ui;
import java.net.URL;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
-import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Color;
@@ -35,7 +31,7 @@
/**
* The main plugin class to be used in the desktop.
*/
-public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{
+public class PDAUIPlugin extends AbstractUIPlugin {
public static String PLUGIN_ID = "org.eclipse.cdt.examples.dsf.pda.ui ";
@@ -63,38 +59,6 @@
*/
private Map fColors = new HashMap();
- /**
- * Active adapter sets. They are accessed using the DSF session ID
- * which owns the debug services.
- */
- private Map fSessionAdapterSets =
- Collections.synchronizedMap(new HashMap());
-
- /**
- * Map of launches for which adapter sets have already been disposed.
- * This map (used as a set) is maintained in order to avoid re-creating an
- * adapter set after the launch was removed from the launch manager, but
- * while the launch is still being held by other classes which may
- * request its adapters. A weak map is used to avoid leaking
- * memory once the launches are no longer referenced.
- *
- * Access to this map is synchronized using the fSessionAdapterSets
- * instance.
- *
- */
- private Map fDisposedSessionAdapterSets =
- new WeakHashMap();
-
- private void disposeAdapterSet(PDALaunch launch) {
- String sessionId = launch.getSession().getId();
- synchronized(fSessionAdapterSets) {
- if ( fSessionAdapterSets.containsKey(sessionId) ) {
- fSessionAdapterSets.remove(sessionId).dispose();
- fDisposedSessionAdapterSets.put(launch, null);
- }
- }
- }
-
/**
* The constructor.
*/
@@ -110,7 +74,10 @@
public void start(BundleContext context) throws Exception {
fContext = context;
super.start(context);
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+// Toggles single threaded adapter example
+// IAdapterManager adapterManager = Platform.getAdapterManager();
+// IAdapterFactory factory = new AdapterFactory();
+// adapterManager.registerAdapters(factory, PDADebugTarget.class);
}
/**
@@ -118,7 +85,6 @@
*/
@Override
public void stop(BundleContext context) throws Exception {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
disposeAdapterSets();
super.stop(context);
plugin = null;
@@ -175,66 +141,15 @@
return color;
}
- SessionAdapterSet getAdapterSet(PDALaunch launch) {
- // Find the correct set of adapters based on the launch. If not found
- // it means that we have a new launch, and we have to create a
- // new set of adapters.
- SessionAdapterSet adapterSet;
- synchronized(fSessionAdapterSets) {
- // The adapter set for the given launch was already disposed.
- // Return a null adapter.
- if (fDisposedSessionAdapterSets.containsKey(launch)) {
- return null;
- }
- String sessionId = launch.getSession().getId();
- adapterSet = fSessionAdapterSets.get(sessionId);
- if (adapterSet == null) {
- adapterSet = new SessionAdapterSet(launch);
- fSessionAdapterSets.put(sessionId, adapterSet);
- }
- }
- return adapterSet;
- }
-
- SessionAdapterSet getAdapterSet(String sessionId) {
- DsfSession session = DsfSession.getSession(sessionId);
- ILaunch launch = (ILaunch)session.getModelAdapter(ILaunch.class);
- if (launch instanceof PDALaunch) {
- return getAdapterSet((PDALaunch)launch);
- }
- return null;
- }
-
/**
* Dispose adapter sets for all launches.
*/
private void disposeAdapterSets() {
for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
if (launch instanceof PDALaunch) {
- disposeAdapterSet((PDALaunch)launch);
+ PDAAdapterFactory.disposeAdapterSet(launch);
}
}
}
- public void launchesRemoved(ILaunch[] launches) {
- // Dispose the set of adapters for a launch only after the launch is
- // removed from the view. If the launch is terminated, the adapters
- // are still needed to populate the contents of the view.
- for (ILaunch launch : launches) {
- if (launch instanceof PDALaunch) {
- disposeAdapterSet((PDALaunch)launch);
- }
- }
- }
-
- public void launchesTerminated(ILaunch[] launches) {
- }
-
- public void launchesAdded(ILaunch[] launches) {
- }
-
- public void launchesChanged(ILaunch[] launches) {
- }
-
-}
-
+ }
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.pda.ui;
-
-import org.eclipse.cdt.dsf.datamodel.IDMContext;
-import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand;
-import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoCommand;
-import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepOverCommand;
-import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepReturnCommand;
-import org.eclipse.cdt.dsf.debug.ui.actions.DsfSuspendCommand;
-import org.eclipse.cdt.dsf.debug.ui.contexts.DsfSuspendTrigger;
-import org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
-import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
-import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
-import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfSelectionPolicy;
-import org.eclipse.cdt.dsf.service.DsfSession;
-import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
-import org.eclipse.cdt.examples.dsf.pda.PDAPlugin;
-import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch;
-import org.eclipse.cdt.examples.dsf.pda.ui.actions.PDATerminateCommand;
-import org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.PDAVMAdapter;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.commands.IResumeHandler;
-import org.eclipse.debug.core.commands.IStepIntoHandler;
-import org.eclipse.debug.core.commands.IStepOverHandler;
-import org.eclipse.debug.core.commands.IStepReturnHandler;
-import org.eclipse.debug.core.commands.ISuspendHandler;
-import org.eclipse.debug.core.commands.ITerminateHandler;
-import org.eclipse.debug.core.model.IDebugModelProvider;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
-
-/**
- * Contains the set of adapters that are created for each session instance.
- */
-class SessionAdapterSet {
- // View Model adapter
- final PDAVMAdapter fViewModelAdapter;
-
- // Source lookup and positioning adapter
- final DsfSourceDisplayAdapter fSourceDisplayAdapter;
-
- // Command adapters
- final DsfStepIntoCommand fStepIntoCommand;
- final DsfStepOverCommand fStepOverCommand;
- final DsfStepReturnCommand fStepReturnCommand;
- final DsfSuspendCommand fSuspendCommand;
- final DsfResumeCommand fResumeCommand;
- final PDATerminateCommand fTerminateCommand;
- final DsfSuspendTrigger fSuspendTrigger;
-
- // Adapters for integration with other UI actions
- final IDebugModelProvider fDebugModelProvider;
- final PDALaunch fLaunch;
-
- final SteppingController fSteppingController;
-
- final IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
-
- SessionAdapterSet(PDALaunch launch) {
- // Initialize launch and session.
- fLaunch = launch;
- DsfSession session = launch.getSession();
-
- // register stepping controller
- fSteppingController = new SteppingController(session);
- session.registerModelAdapter(SteppingController.class, fSteppingController);
-
- // Initialize VM
- fViewModelAdapter = new PDAVMAdapter(session, fSteppingController);
-
- // Initialize source lookup
- fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController);
- session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
-
- // Default selection policy
- fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
- session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
-
- // Initialize retargetable command handler.
- fStepIntoCommand = new DsfStepIntoCommand(session, null);
- fStepOverCommand = new DsfStepOverCommand(session, null);
- fStepReturnCommand = new DsfStepReturnCommand(session);
- fSuspendCommand = new DsfSuspendCommand(session);
- fResumeCommand = new DsfResumeCommand(session);
- fTerminateCommand = new PDATerminateCommand(session);
- fSuspendTrigger = new DsfSuspendTrigger(session, fLaunch);
-
- session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
- session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
- session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
- session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
- session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
- session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
-
- // Initialize debug model provider
- fDebugModelProvider = new IDebugModelProvider() {
- public String[] getModelIdentifiers() {
- return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL };
- }
- };
- session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
- }
-
- void dispose() {
- DsfSession session = fLaunch.getSession();
-
- fViewModelAdapter.dispose();
-
- session.unregisterModelAdapter(ISourceDisplay.class);
- if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
-
- session.unregisterModelAdapter(SteppingController.class);
- fSteppingController.dispose();
-
- session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
-
- session.unregisterModelAdapter(IStepIntoHandler.class);
- session.unregisterModelAdapter(IStepOverHandler.class);
- session.unregisterModelAdapter(IStepReturnHandler.class);
- session.unregisterModelAdapter(ISuspendHandler.class);
- session.unregisterModelAdapter(IResumeHandler.class);
- session.unregisterModelAdapter(ITerminateHandler.class);
- fStepIntoCommand.dispose();
- fStepOverCommand.dispose();
- fStepReturnCommand.dispose();
- fSuspendCommand.dispose();
- fResumeCommand.dispose();
- fTerminateCommand.dispose();
- fSuspendTrigger.dispose();
- }
-
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java Wed Aug 05 17:35:39 2009 -0500
@@ -24,7 +24,6 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.ISourceLocator;
@@ -74,11 +73,6 @@
dsfExecutor.prestartCoreThread();
fExecutor = dsfExecutor;
fSession = DsfSession.startSession(fExecutor, PDAPlugin.ID_PDA_DEBUG_MODEL);
-
- // Register the launch as an adapter This ensures that the launch,
- // and debug model ID will be associated with all DMContexts from this
- // session.
- fSession.registerModelAdapter(ILaunch.class, this);
}
/**
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java Wed Aug 05 17:35:39 2009 -0500
@@ -155,11 +155,7 @@
// Register the service with OSGi as the last step in initialization of
// the service.
register(
- new String[] {
- ICommandControl.class.getName(),
- ICommandControlService.class.getName(),
- PDACommandControl.class.getName()
- },
+ new String[]{ ICommandControl.class.getName(), PDACommandControl.class.getName() },
new Hashtable());
rm.done();
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java Wed Aug 05 17:35:39 2009 -0500
@@ -34,7 +34,6 @@
import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAResumeCommand;
import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAStepCommand;
import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAStepReturnCommand;
-import org.eclipse.cdt.examples.dsf.pda.service.commands.PDASuspendCommand;
import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAVMResumeCommand;
import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAVMSuspendCommand;
import org.osgi.framework.BundleContext;
@@ -555,7 +554,7 @@
final PDAThreadDMContext threadCtx = (PDAThreadDMContext)context;
fThreads.get(threadCtx.getID()).fSuspendPending = true;
fCommandControl.queueCommand(
- new PDASuspendCommand(threadCtx),
+ new PDAVMSuspendCommand(fDMContext),
new DataRequestMonitor(getExecutor(), rm) {
@Override
protected void handleFailure() {
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/AsyncDataViewer.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/AsyncDataViewer.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.Query;
-import org.eclipse.cdt.dsf.ui.concurrent.DisplayDsfExecutor;
-import org.eclipse.jface.viewers.ILazyContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * Data viewer based on a table, which reads data using asynchronous methods.
- *
- * This viewer implements the {@link ILazyContentProvider} interface
- * which is used by the JFace TableViewer class to populate a Table. This
- * interface contains separate asynchronous methods for requesting the count
- * and values for individual indexes, which neatly correspond to the methods
- * in {@link IDataGenerator}. As an added optimization, this viewer
- * implementation checks for the range of visible items in the view upon each
- * request, and it cancels old requests which scroll out of view but have not
- * been completed yet. However, it is up to the data generator implementation
- * to check the canceled state of the requests and ignore them.
- *
- */
-@ConfinedToDsfExecutor("fDisplayExecutor")
-public class AsyncDataViewer
- implements ILazyContentProvider, IDataGenerator.Listener
-{
- // Executor to use instead of Display.asyncExec().
- @ThreadSafe
- final private DsfExecutor fDisplayExecutor;
-
- // The viewer and generator that this content provider using.
- final private TableViewer fViewer;
- final private IDataGenerator fDataGenerator;
-
- // Fields used in request cancellation logic.
- private List fItemDataRequestMonitors = new LinkedList();
- private Set fIndexesToCancel = new HashSet();
- private int fCancelCallsPending = 0;
-
- public AsyncDataViewer(TableViewer viewer, IDataGenerator generator) {
- fViewer = viewer;
- fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(fViewer.getTable().getDisplay());
- fDataGenerator = generator;
- fDataGenerator.addListener(this);
- }
-
- public void dispose() {
- fDataGenerator.removeListener(this);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // Set the initial count to the viewer after the input is set.
- queryItemCount();
- }
-
- public void updateElement(final int index) {
- // Calculate the visible index range.
- final int topIdx = fViewer.getTable().getTopIndex();
- final int botIdx = topIdx + getVisibleItemCount(topIdx);
-
- // Request the item for the given index.
- queryValue(index);
-
- // Invoke a cancel task with a delay. The delay allows multiple cancel
- // calls to be combined together improving performance of the viewer.
- fCancelCallsPending++;
- fDisplayExecutor.schedule(
- new Runnable() { public void run() {
- cancelStaleRequests(topIdx, botIdx);
- }},
- 1, TimeUnit.MILLISECONDS);
- }
-
- private int getVisibleItemCount(int top) {
- Table table = fViewer.getTable();
- int itemCount = table.getItemCount();
- return Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - top);
- }
-
- @ThreadSafe
- public void countChanged() {
- queryItemCount();
- }
-
- @ThreadSafe
- public void valuesChanged(final Set indexes) {
- // Mark the changed items in table viewer as dirty, this will
- // trigger update requests for these indexes if they are
- // visible in the viewer.
- final TableViewer tableViewer = fViewer;
- fDisplayExecutor.execute( new Runnable() {
- public void run() {
- if (!fViewer.getTable().isDisposed()) {
- for (Integer index : indexes) {
- tableViewer.clear(index);
- }
- }
- }});
- }
-
-
- private void queryItemCount() {
- // Request count from data provider. When the count is returned, we
- // have to re-dispatch into the display thread to avoid calling
- // the table widget on the DSF dispatch thread.
- fIndexesToCancel.clear();
- fDataGenerator.getCount(
- // Use the display executor to construct the request monitor, this
- // will cause the handleCompleted() method to be automatically
- // called on the display thread.
- new DataRequestMonitor(fDisplayExecutor, null) {
- @Override
- protected void handleCompleted() {
- if (!fViewer.getTable().isDisposed()) {
- fViewer.setItemCount(getData());
- fViewer.getTable().clearAll();
- }
- }
- });
-
- }
-
-
- // Dedicated class for data item requests. This class holds the index
- // argument so it can be examined when canceling stale requests.
- private class ValueDataRequestMonitor extends DataRequestMonitor {
-
- /** Index is used when canceling stale requests. */
- int fIndex;
-
- ValueDataRequestMonitor(int index) {
- super(fDisplayExecutor, null);
- fIndex = index;
- }
-
- @Override
- protected void handleCompleted() {
- fItemDataRequestMonitors.remove(this);
-
- // Check if the request completed successfully, otherwise ignore it.
- if (isSuccess()) {
- if (!fViewer.getTable().isDisposed()) {
- fViewer.replace(getData(), fIndex);
- }
- }
- }
- }
-
- private void queryValue(final int index) {
- ValueDataRequestMonitor rm = new ValueDataRequestMonitor(index);
- fItemDataRequestMonitors.add(rm);
- fDataGenerator.getValue(index, rm);
- }
-
- private void cancelStaleRequests(int topIdx, int botIdx) {
- // Decrement the count of outstanding cancel calls.
- fCancelCallsPending--;
-
- // Must check again, in case disposed while re-dispatching.
- if (fDataGenerator == null || fViewer.getTable().isDisposed()) return;
-
- // Go through the outstanding requests and cancel any that
- // are not visible anymore.
- for (Iterator itr = fItemDataRequestMonitors.iterator(); itr.hasNext();) {
- ValueDataRequestMonitor item = itr.next();
- if (item.fIndex < topIdx || item.fIndex > botIdx) {
- // Set the item to canceled status, so that the data provider
- // will ignore it.
- item.cancel();
-
- // Add the item index to list of indexes that were canceled,
- // which will be sent to the table widget.
- fIndexesToCancel.add(item.fIndex);
-
- // Remove the item from the outstanding cancel requests.
- itr.remove();
- }
- }
- if (!fIndexesToCancel.isEmpty() && fCancelCallsPending == 0) {
- Set canceledIdxs = fIndexesToCancel;
- fIndexesToCancel = new HashSet();
-
- // Clear the indexes of the canceled request, so that the
- // viewer knows to request them again when needed.
- // Note: clearing using TableViewer.clear(int) seems very
- // inefficient, it's better to use Table.clear(int[]).
- int[] canceledIdxsArray = new int[canceledIdxs.size()];
- int i = 0;
- for (Integer index : canceledIdxs) {
- canceledIdxsArray[i++] = index;
- }
- fViewer.getTable().clear(canceledIdxsArray);
- }
- }
-
-
- public static void main(String[] args) {
- // Create the shell to hold the viewer.
- Display display = new Display();
- Shell shell = new Shell(display, SWT.SHELL_TRIM);
- shell.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- shell.setLayoutData(data);
- Font font = new Font(display, "Courier", 10, SWT.NORMAL);
-
- // Create the table viewer.
- TableViewer tableViewer = new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
- tableViewer.getControl().setLayoutData(data);
-
- // Create the data generator.
- final IDataGenerator generator = new DataGeneratorWithExecutor();
-
- // Create the content provider which will populate the viewer.
- AsyncDataViewer contentProvider = new AsyncDataViewer(tableViewer, generator);
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(new Object());
-
- // Open the shell and service the display dispatch loop until user
- // closes the shell.
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // The IDataGenerator.shutdown() method is asynchronous, this requires
- // using a query again in order to wait for its completion.
- Query shutdownQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- generator.shutdown(rm);
- }
- };
- ImmediateExecutor.getInstance().execute(shutdownQuery);
- try {
- shutdownQuery.get();
- } catch (Exception e) {}
-
- // Shut down the display.
- font.dispose();
- display.dispose();
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/DataGeneratorWithExecutor.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/DataGeneratorWithExecutor.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.examples.dsf.DsfExamplesPlugin;
-
-/**
- * DSF Executor-based implementation of the data generator.
- *
- * This generator uses a queue of client requests and processes these
- * requests periodically using a DSF executor. The main feature of this
- * generator is that it uses the executor as its only synchronization object.
- * This means that all the fields with the exception of the executor can only
- * be accessed while running in the executor thread.
- *
- */
-//TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
-//indicating allowed thread access to this class/method/member
-public class DataGeneratorWithExecutor implements IDataGenerator {
-
- // Request objects are used to serialize the interface calls into objects
- // which can then be pushed into a queue.
- // TODO Ecercise 4 - Add an annotationindicating allowed concurrency access
- // Hint: Request and its subclasses have all their fields declared as final.
- abstract class Request {
- final RequestMonitor fRequestMonitor;
-
- Request(RequestMonitor rm) {
- fRequestMonitor = rm;
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- class CountRequest extends Request {
- CountRequest(DataRequestMonitor rm) {
- super(rm);
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- class ItemRequest extends Request {
- final int fIndex;
- ItemRequest(int index, DataRequestMonitor rm) {
- super(rm);
- fIndex = index;
- }
- }
-
- // The executor used to access all internal data of the generator.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- // Hint: If a member does not have an annotation, the programmer can assume
- // that the concurrency rule that applies to the class also applies to this
- // member.
- private DsfExecutor fExecutor;
-
- // Main request queue of the data generator. The getValue(), getCount(),
- // and shutdown() methods write into the queue, while the serviceQueue()
- // method reads from it.
- // The executor used to access all internal data of the generator.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private List fQueue = new LinkedList();
-
- // List of listeners is not synchronized, it also has to be accessed
- // using the executor.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private List fListeners = new LinkedList();
-
- // Current number of elements in this generator.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private int fCount = MIN_COUNT;
-
- // Counter used to determine when to reset the element count.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private int fCountResetTrigger = 0;
-
- // Elements which were modified since the last reset.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private Set fChangedIndexes = new HashSet();
-
- // Flag used to ensure that requests are processed sequentially.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private boolean fServiceQueueInProgress = false;
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public DataGeneratorWithExecutor() {
- // Create the executor
- fExecutor = new DefaultDsfExecutor("Supplier Executor");
-
- // Schedule a runnable to make the random changes.
- fExecutor.scheduleAtFixedRate(
- new DsfRunnable() {
- public void run() {
- randomChanges();
- }
- },
- RANDOM_CHANGE_INTERVAL,
- RANDOM_CHANGE_INTERVAL,
- TimeUnit.MILLISECONDS);
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public void shutdown(final RequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- // Empty the queue of requests and fail them.
- for (Request request : fQueue) {
- request.fRequestMonitor.setStatus(
- new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- request.fRequestMonitor.done();
- }
- fQueue.clear();
-
- // Kill executor.
- fExecutor.shutdown();
- rm.done();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public void getCount(final DataRequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fQueue.add(new CountRequest(rm));
- serviceQueue();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public void getValue(final int index, final DataRequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fQueue.add(new ItemRequest(index, rm));
- serviceQueue();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public void addListener(final Listener listener) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fListeners.add(listener);
- }
- });
- } catch (RejectedExecutionException e) {}
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- public void removeListener(final Listener listener) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fListeners.remove(listener);
- }
- });
- } catch (RejectedExecutionException e) {}
- }
-
- // Main processing function of this generator.
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void serviceQueue() {
-
- // TODO Exercise 3 - Add logic to discard cancelled requests from queue.
- // Hint: Since serviceQueue() is called using the executor, and the
- // fQueue list can only be modified when running in the executor
- // thread. This method can safely iterate and modify fQueue without
- // risk of race conditions or concurrent modification exceptions.
-
- // If a queue servicing is already scheduled, do nothing.
- if (fServiceQueueInProgress) {
- return;
- }
-
- if (fQueue.size() != 0) {
- // If there are requests to service, remove one from the queue and
- // schedule a runnable to process the request after a processing
- // delay.
- fServiceQueueInProgress = true;
- final Request request = fQueue.remove(0);
- fExecutor.schedule(
- new DsfRunnable() {
- public void run() {
- if (request instanceof CountRequest) {
- processCountRequest((CountRequest)request);
- } else if (request instanceof ItemRequest) {
- processItemRequest((ItemRequest)request);
- }
-
- // Reset the processing flag and process next
- // request.
- fServiceQueueInProgress = false;
- serviceQueue();
- }
- },
- PROCESSING_DELAY, TimeUnit.MILLISECONDS);
- }
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void processCountRequest(CountRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- rm.setData(fCount);
- rm.done();
- }
-
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void processItemRequest(ItemRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- if (fChangedIndexes.contains(request.fIndex)) {
- rm.setData("Changed: " + request.fIndex);
- } else {
- rm.setData(Integer.toString(request.fIndex));
- }
- rm.done();
- }
-
- /**
- * This method simulates changes in the supplier's data set.
- */
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void randomChanges() {
- // Once every number of changes, reset the count, the rest of the
- // times just change certain values.
- if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0){
- randomCountReset();
- } else {
- randomDataChange();
- }
- }
-
- /**
- * Calculates new size for provider's data set.
- */
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void randomCountReset() {
- // Calculate the new count.
- Random random = new java.util.Random();
- fCount = MIN_COUNT + Math.abs(random.nextInt()) % (MAX_COUNT - MIN_COUNT);
-
- // Reset the changed values.
- fChangedIndexes.clear();
-
- // Notify listeners
- for (Listener listener : fListeners) {
- listener.countChanged();
- }
- }
-
- /**
- * Invalidates a random range of indexes.
- */
- // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
- // indicating allowed thread access to this class/method/member
- private void randomDataChange() {
- // Calculate the indexes to change.
- Random random = new java.util.Random();
- Set set = new HashSet();
- for (int i = 0; i < fCount * RANDOM_CHANGE_SET_PERCENTAGE / 100; i++) {
- set.add( new Integer(Math.abs(random.nextInt()) % fCount) );
- }
-
- // Add the indexes to an overall set of changed indexes.
- fChangedIndexes.addAll(set);
-
- // Notify listeners
- for (Listener listener : fListeners) {
- listener.valuesChanged(set);
- }
- }
-}
-
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/DataGeneratorWithThread.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/DataGeneratorWithThread.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.examples.dsf.DsfExamplesPlugin;
-
-/**
- * Thread-based implementation of the data generator.
- *
- * This generator is based around a queue of client requests and a thread which
- * reads the requests from the queue and processes them. The distinguishing
- * feature of this generator is that it uses a a blocking queue as the main
- * synchronization object. However, fListeners, fShutdown, and fChangedIndexes
- * fields also need to be thread-safe and so they implement their own
- * synchronization.
- *
- */
-public class DataGeneratorWithThread extends Thread implements IDataGenerator {
-
- // Request objects are used to serialize the interface calls into objects
- // which can then be pushed into a queue.
- abstract class Request {
- final RequestMonitor fRequestMonitor;
-
- Request(RequestMonitor rm) {
- fRequestMonitor = rm;
- }
- }
-
- class CountRequest extends Request {
- CountRequest(DataRequestMonitor rm) {
- super(rm);
- }
- }
-
- class ItemRequest extends Request {
- final int fIndex;
- ItemRequest(int index, DataRequestMonitor rm) {
- super(rm);
- fIndex = index;
- }
- }
-
- class ShutdownRequest extends Request {
- ShutdownRequest(RequestMonitor rm) {
- super(rm);
- }
- }
-
- // Main request queue of the data generator. The getValue(), getCount(),
- // and shutdown() methods write into the queue, while the run() method
- // reads from it.
- private final BlockingQueue fQueue = new LinkedBlockingQueue();
-
- // ListenerList class provides thread safety.
- private ListenerList fListeners = new ListenerList();
-
- // Current number of elements in this generator.
- private int fCount = MIN_COUNT;
-
- // Counter used to determine when to reset the element count.
- private int fCountResetTrigger = 0;
-
- // Elements which were modified since the last reset.
- private Set fChangedIndexes = Collections.synchronizedSet(new HashSet());
-
- // Used to determine when to make changes in data.
- private long fLastChangeTime = System.currentTimeMillis();
-
- // Flag indicating when the generator has been shut down.
- private AtomicBoolean fShutdown = new AtomicBoolean(false);
-
- public DataGeneratorWithThread() {
- // Immediately kick off the request processing thread.
- start();
- }
-
- public void shutdown(RequestMonitor rm) {
- // Mark the generator as shut down. After the fShutdown flag is set,
- // all new requests should be shut down.
- if (!fShutdown.getAndSet(true)) {
- fQueue.add(new ShutdownRequest(rm));
- } else {
- //
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getCount(DataRequestMonitor rm) {
- if (!fShutdown.get()) {
- fQueue.add(new CountRequest(rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getValue(int index, DataRequestMonitor rm) {
- if (!fShutdown.get()) {
- fQueue.add(new ItemRequest(index, rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void addListener(Listener listener) {
- fListeners.add(listener);
- }
-
- public void removeListener(Listener listener) {
- fListeners.remove(listener);
- }
-
- @Override
- public void run() {
- try {
- while(true) {
- // Get the next request from the queue. The time-out
- // ensures that that the random changes get processed.
- final Request request = fQueue.poll(100, TimeUnit.MILLISECONDS);
-
- // If a request was dequeued, process it.
- if (request != null) {
- // Simulate a processing delay.
- Thread.sleep(PROCESSING_DELAY);
-
- if (request instanceof CountRequest) {
- processCountRequest((CountRequest)request);
- } else if (request instanceof ItemRequest) {
- processItemRequest((ItemRequest)request);
- } else if (request instanceof ShutdownRequest) {
- // If shutting down, just break out of the while(true)
- // loop and thread will exit.
- request.fRequestMonitor.done();
- break;
- }
- }
-
- // Simulate data changes.
- randomChanges();
- }
- }
- catch (InterruptedException x) {}
- }
-
- private void processCountRequest(CountRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- rm.setData(fCount);
- rm.done();
- }
-
- private void processItemRequest(ItemRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- if (fChangedIndexes.contains(request.fIndex)) {
- rm.setData("Changed: " + request.fIndex);
- } else {
- rm.setData(Integer.toString(request.fIndex));
- }
- rm.done();
- }
-
-
- private void randomChanges() {
- // Check if enough time is elapsed.
- if (System.currentTimeMillis() > fLastChangeTime + RANDOM_CHANGE_INTERVAL) {
- fLastChangeTime = System.currentTimeMillis();
-
- // Once every number of changes, reset the count, the rest of the
- // times just change certain values.
- if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0){
- randomCountReset();
- } else {
- randomDataChange();
- }
- }
- }
-
- private void randomCountReset() {
- // Calculate the new count.
- Random random = new java.util.Random();
- fCount = MIN_COUNT + Math.abs(random.nextInt()) % (MAX_COUNT - MIN_COUNT);
-
- // Reset the changed values.
- fChangedIndexes.clear();
-
- // Notify listeners
- for (Object listener : fListeners.getListeners()) {
- ((Listener)listener).countChanged();
- }
- }
-
- private void randomDataChange() {
- // Calculate the indexes to change.
- Random random = new java.util.Random();
- Set set = new HashSet();
- for (int i = 0; i < fCount * RANDOM_CHANGE_SET_PERCENTAGE / 100; i++) {
- set.add( new Integer(Math.abs(random.nextInt()) % fCount) );
- }
-
- // Add the indexes to an overall set of changed indexes.
- fChangedIndexes.addAll(set);
-
- // Notify listeners
- for (Object listener : fListeners.getListeners()) {
- ((Listener)listener).valuesChanged(set);
- }
- }
-}
-
-
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/IDataGenerator.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/IDataGenerator.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer;
-
-import java.util.Set;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-
-/**
- * Data generator is simple source of data used to populate the example table
- * view. It contains two asynchronous methods for retrieving the data
- * parameters: the count and the value for a given index. It also allows the
- * view to receive events indicating when the data supplied by the generator
- * is changed.
- */
-// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
-// indicating allowed thread access to this class/method/member
-public interface IDataGenerator {
-
- // Constants which control the data generator behavior.
- // Changing the count range can stress the scalability of the system, while
- // changing of the process delay and random change interval can stress
- // its performance.
- final static int MIN_COUNT = 100;
- final static int MAX_COUNT = 200;
- final static int PROCESSING_DELAY = 10;
- final static int RANDOM_CHANGE_INTERVAL = 10000;
- final static int RANDOM_COUNT_CHANGE_INTERVALS = 3;
- final static int RANDOM_CHANGE_SET_PERCENTAGE = 10;
-
-
- // Listener interface that the view needs to implement to react
- // to the changes in data.
- public interface Listener {
- void countChanged();
- void valuesChanged(Set indexes);
- }
-
- // Data access methods.
- void getCount(DataRequestMonitor rm);
- void getValue(int index, DataRequestMonitor rm);
-
- // Method used to shutdown the data generator including any threads that
- // it may use.
- void shutdown(RequestMonitor rm);
-
- // Methods for registering change listeners.
- void addListener(Listener listener);
- void removeListener(Listener listener);
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/SyncDataViewer.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/SyncDataViewer.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer;
-
-import java.util.Set;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.Query;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Data viewer based on a table, which reads data using synchronous methods.
- *
- * This viewer implements the {@link IStructuredContentProvider} interface
- * which is used by the JFace TableViewer class to populate a Table. This
- * interface contains one principal methods for reading data {@link #getElements(Object)},
- * which synchronously returns an array of elements. In order to implement this
- * method using the asynchronous data generator, this provider uses the
- * {@link Query} object.
- *
- */
-public class SyncDataViewer
- implements IStructuredContentProvider, IDataGenerator.Listener
-{
- // The viewer and generator that this content provider using.
- final private TableViewer fViewer;
- final private IDataGenerator fDataGenerator;
-
- public SyncDataViewer(TableViewer viewer, IDataGenerator generator) {
- fViewer = viewer;
- fDataGenerator = generator;
- fDataGenerator.addListener(this);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // Not used
- }
-
-
- public Object[] getElements(Object inputElement) {
-
- // Create the query object for reading data count.
- Query countQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- fDataGenerator.getCount(rm);
- }
- };
-
- // Submit the query to be executed. A query implements a runnable
- // interface and it has to be executed in order to do its work.
- ImmediateExecutor.getInstance().execute(countQuery);
- int count = 0;
-
- // Block until the query completes, which will happen when the request
- // monitor of the execute() method is marked done.
- try {
- count = countQuery.get();
- } catch (Exception e) {
- // InterruptedException and ExecutionException can be thrown here.
- // ExecutionException containing a CoreException will be thrown
- // if an error status is set to the Query's request monitor.
- return new Object[0];
- }
-
- // Create the array that will be filled with elements.
- // For each index in the array execute a query to get the element at
- // that index.
- final Object[] elements = new Object[count];
-
- for (int i = 0; i < count; i++) {
- final int index = i;
- Query valueQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- fDataGenerator.getValue(index, rm);
- }
- };
- ImmediateExecutor.getInstance().execute(valueQuery);
- try {
- elements[i] = valueQuery.get();
- } catch (Exception e) {
- elements[i] = "error";
- }
- }
- return elements;
- }
-
- public void dispose() {
- fDataGenerator.removeListener(this);
- }
-
- public void countChanged() {
- // For any event from the generator, refresh the whole viewer.
- refreshViewer();
- }
-
- public void valuesChanged(Set indexes) {
- // For any event from the generator, refresh the whole viewer.
- refreshViewer();
- }
-
- private void refreshViewer() {
- // TODO Exercise 5 - Add a call to getElements() to force a deadlock.
-
- // This method may be called on any thread, switch to the display
- // thread before calling the viewer.
- Display display = fViewer.getControl().getDisplay();
- display.asyncExec( new Runnable() {
- public void run() {
- if (!fViewer.getControl().isDisposed()) {
- fViewer.refresh();
- }
- }
- });
- }
-
- public static void main(String[] args) {
- // Create the shell to hold the viewer.
- Display display = new Display();
- Shell shell = new Shell(display, SWT.SHELL_TRIM);
- shell.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- shell.setLayoutData(data);
- Font font = new Font(display, "Courier", 10, SWT.NORMAL);
-
- // Create the table viewer.
- TableViewer tableViewer = new TableViewer(shell, SWT.BORDER);
- tableViewer.getControl().setLayoutData(data);
-
- // Create the data generator.
- // TODO Exercise 5 - Use the DataGeneratorWithExecutor() instead.
- final IDataGenerator generator = new DataGeneratorWithThread();
-
- // Create the content provider which will populate the viewer.
- SyncDataViewer contentProvider = new SyncDataViewer(tableViewer, generator);
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(new Object());
-
- // Open the shell and service the display dispatch loop until user
- // closes the shell.
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // The IDataGenerator.shutdown() method is asynchronous, this requires
- // using a query again in order to wait for its completion.
- Query shutdownQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- generator.shutdown(rm);
- }
- };
- ImmediateExecutor.getInstance().execute(shutdownQuery);
- try {
- shutdownQuery.get();
- } catch (Exception e) {}
-
- // Shut down the display.
- font.dispose();
- display.dispose();
- }
-
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/AsyncDataViewer.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/AsyncDataViewer.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer.answers;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.Query;
-import org.eclipse.cdt.dsf.ui.concurrent.DisplayDsfExecutor;
-import org.eclipse.jface.viewers.ILazyContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * Data viewer based on a table, which reads data using asynchronous methods.
- *
- * This viewer implements the {@link ILazyContentProvider} interface
- * which is used by the JFace TableViewer class to populate a Table. This
- * interface contains separate asynchronous methods for requesting the count
- * and values for individual indexes, which neatly correspond to the methods
- * in {@link IDataGenerator}. As an added optimization, this viewer
- * implementation checks for the range of visible items in the view upon each
- * request, and it cancels old requests which scroll out of view but have not
- * been completed yet. However, it is up to the data generator implementation
- * to check the canceled state of the requests and ignore them.
- *
- */
-@ConfinedToDsfExecutor("fDisplayExecutor")
-public class AsyncDataViewer
- implements ILazyContentProvider, IDataGenerator.Listener
-{
- // Executor to use instead of Display.asyncExec().
- @ThreadSafe
- final private DsfExecutor fDisplayExecutor;
-
- // The viewer and generator that this content provider using.
- final private TableViewer fViewer;
- final private IDataGenerator fDataGenerator;
-
- // Fields used in request cancellation logic.
- private List fItemDataRequestMonitors = new LinkedList();
- private Set fIndexesToCancel = new HashSet();
- private int fCancelCallsPending = 0;
-
- public AsyncDataViewer(TableViewer viewer, IDataGenerator generator) {
- fViewer = viewer;
- fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(fViewer.getTable().getDisplay());
- fDataGenerator = generator;
- fDataGenerator.addListener(this);
- }
-
- public void dispose() {
- fDataGenerator.removeListener(this);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // Set the initial count to the viewer after the input is set.
- queryItemCount();
- }
-
- public void updateElement(final int index) {
- // Calculate the visible index range.
- final int topIdx = fViewer.getTable().getTopIndex();
- final int botIdx = topIdx + getVisibleItemCount(topIdx);
-
- // Request the item for the given index.
- queryValue(index);
-
- // Invoke a cancel task with a delay. The delay allows multiple cancel
- // calls to be combined together improving performance of the viewer.
- fCancelCallsPending++;
- fDisplayExecutor.schedule(
- new Runnable() { public void run() {
- cancelStaleRequests(topIdx, botIdx);
- }},
- 1, TimeUnit.MILLISECONDS);
- }
-
- private int getVisibleItemCount(int top) {
- Table table = fViewer.getTable();
- int itemCount = table.getItemCount();
- return Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - top);
- }
-
- @ThreadSafe
- public void countChanged() {
- queryItemCount();
- }
-
- @ThreadSafe
- public void valuesChanged(final Set indexes) {
- // Mark the changed items in table viewer as dirty, this will
- // trigger update requests for these indexes if they are
- // visible in the viewer.
- final TableViewer tableViewer = fViewer;
- fDisplayExecutor.execute( new Runnable() {
- public void run() {
- if (!fViewer.getTable().isDisposed()) {
- for (Integer index : indexes) {
- tableViewer.clear(index);
- }
- }
- }});
- }
-
-
- private void queryItemCount() {
- // Request count from data provider. When the count is returned, we
- // have to re-dispatch into the display thread to avoid calling
- // the table widget on the DSF dispatch thread.
- fIndexesToCancel.clear();
- fDataGenerator.getCount(
- // Use the display executor to construct the request monitor, this
- // will cause the handleCompleted() method to be automatically
- // called on the display thread.
- new DataRequestMonitor(fDisplayExecutor, null) {
- @Override
- protected void handleCompleted() {
- if (!fViewer.getTable().isDisposed()) {
- fViewer.setItemCount(getData());
- fViewer.getTable().clearAll();
- }
- }
- });
-
- }
-
-
- // Dedicated class for data item requests. This class holds the index
- // argument so it can be examined when canceling stale requests.
- private class ValueDataRequestMonitor extends DataRequestMonitor {
-
- /** Index is used when canceling stale requests. */
- int fIndex;
-
- ValueDataRequestMonitor(int index) {
- super(fDisplayExecutor, null);
- fIndex = index;
- }
-
- @Override
- protected void handleCompleted() {
- fItemDataRequestMonitors.remove(this);
-
- // Check if the request completed successfully, otherwise ignore it.
- if (isSuccess()) {
- if (!fViewer.getTable().isDisposed()) {
- fViewer.replace(getData(), fIndex);
- }
- }
- }
- }
-
- private void queryValue(final int index) {
- ValueDataRequestMonitor rm = new ValueDataRequestMonitor(index);
- fItemDataRequestMonitors.add(rm);
- fDataGenerator.getValue(index, rm);
- }
-
- private void cancelStaleRequests(int topIdx, int botIdx) {
- // Decrement the count of outstanding cancel calls.
- fCancelCallsPending--;
-
- // Must check again, in case disposed while re-dispatching.
- if (fDataGenerator == null || fViewer.getTable().isDisposed()) return;
-
- // Go through the outstanding requests and cancel any that
- // are not visible anymore.
- for (Iterator itr = fItemDataRequestMonitors.iterator(); itr.hasNext();) {
- ValueDataRequestMonitor item = itr.next();
- if (item.fIndex < topIdx || item.fIndex > botIdx) {
- // Set the item to canceled status, so that the data provider
- // will ignore it.
- item.cancel();
-
- // Add the item index to list of indexes that were canceled,
- // which will be sent to the table widget.
- fIndexesToCancel.add(item.fIndex);
-
- // Remove the item from the outstanding cancel requests.
- itr.remove();
- }
- }
- if (!fIndexesToCancel.isEmpty() && fCancelCallsPending == 0) {
- Set canceledIdxs = fIndexesToCancel;
- fIndexesToCancel = new HashSet();
-
- // Clear the indexes of the canceled request, so that the
- // viewer knows to request them again when needed.
- // Note: clearing using TableViewer.clear(int) seems very
- // inefficient, it's better to use Table.clear(int[]).
- int[] canceledIdxsArray = new int[canceledIdxs.size()];
- int i = 0;
- for (Integer index : canceledIdxs) {
- canceledIdxsArray[i++] = index;
- }
- fViewer.getTable().clear(canceledIdxsArray);
- }
- }
-
-
- public static void main(String[] args) {
- // Create the shell to hold the viewer.
- Display display = new Display();
- Shell shell = new Shell(display, SWT.SHELL_TRIM);
- shell.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- shell.setLayoutData(data);
- Font font = new Font(display, "Courier", 10, SWT.NORMAL);
-
- // Create the table viewer.
- TableViewer tableViewer = new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
- tableViewer.getControl().setLayoutData(data);
-
- // Create the data generator.
- final IDataGenerator generator = new DataGeneratorWithExecutor();
-
- // Create the content provider which will populate the viewer.
- AsyncDataViewer contentProvider = new AsyncDataViewer(tableViewer, generator);
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(new Object());
-
- // Open the shell and service the display dispatch loop until user
- // closes the shell.
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // The IDataGenerator.shutdown() method is asynchronous, this requires
- // using a query again in order to wait for its completion.
- Query shutdownQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- generator.shutdown(rm);
- }
- };
- ImmediateExecutor.getInstance().execute(shutdownQuery);
- try {
- shutdownQuery.get();
- } catch (Exception e) {}
-
- // Shut down the display.
- font.dispose();
- display.dispose();
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/DataGeneratorWithExecutor.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/DataGeneratorWithExecutor.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer.answers;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.Immutable;
-import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.examples.dsf.DsfExamplesPlugin;
-
-/**
- * DSF Executor-based implementation of the data generator.
- *
- * This generator uses a queue of client requests and processes these
- * requests periodically using a DSF executor. The main feature of this
- * generator is that it uses the executor as its only synchronization object.
- * This means that all the fields with the exception of the executor can only
- * be accessed while running in the executor thread.
- *
- */
-@ThreadSafe
-public class DataGeneratorWithExecutor implements IDataGenerator {
-
- // Request objects are used to serialize the interface calls into objects
- // which can then be pushed into a queue.
- @Immutable
- abstract class Request {
- final RequestMonitor fRequestMonitor;
-
- Request(RequestMonitor rm) {
- fRequestMonitor = rm;
- }
- }
-
- @Immutable
- class CountRequest extends Request {
- CountRequest(DataRequestMonitor rm) {
- super(rm);
- }
- }
-
- @Immutable
- class ItemRequest extends Request {
- final int fIndex;
- ItemRequest(int index, DataRequestMonitor rm) {
- super(rm);
- fIndex = index;
- }
- }
-
- // The executor used to access all internal data of the generator.
- private DsfExecutor fExecutor;
-
- // Main request queue of the data generator. The getValue(), getCount(),
- // and shutdown() methods write into the queue, while the serviceQueue()
- // method reads from it.
- // The executor used to access all internal data of the generator.
- @ConfinedToDsfExecutor("fExecutor")
- private List fQueue = new LinkedList();
-
- // List of listeners is not synchronized, it also has to be accessed
- // using the executor.
- @ConfinedToDsfExecutor("fExecutor")
- private List fListeners = new LinkedList();
-
- // Current number of elements in this generator.
- @ConfinedToDsfExecutor("fExecutor")
- private int fCount = MIN_COUNT;
-
- // Counter used to determine when to reset the element count.
- @ConfinedToDsfExecutor("fExecutor")
- private int fCountResetTrigger = 0;
-
- // Elements which were modified since the last reset.
- @ConfinedToDsfExecutor("fExecutor")
- private Set fChangedIndexes = new HashSet();
-
- // Flag used to ensure that requests are processed sequentially.
- @ConfinedToDsfExecutor("fExecutor")
- private boolean fServiceQueueInProgress = false;
-
- public DataGeneratorWithExecutor() {
- // Create the executor
- fExecutor = new DefaultDsfExecutor("Supplier Executor");
-
- // Schedule a runnable to make the random changes.
- fExecutor.scheduleAtFixedRate(
- new DsfRunnable() {
- public void run() {
- randomChanges();
- }
- },
- RANDOM_CHANGE_INTERVAL,
- RANDOM_CHANGE_INTERVAL,
- TimeUnit.MILLISECONDS);
- }
-
- public void shutdown(final RequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- // Empty the queue of requests and fail them.
- for (Request request : fQueue) {
- request.fRequestMonitor.setStatus(
- new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- request.fRequestMonitor.done();
- }
- fQueue.clear();
-
- // Kill executor.
- fExecutor.shutdown();
- rm.done();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getCount(final DataRequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fQueue.add(new CountRequest(rm));
- serviceQueue();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getValue(final int index, final DataRequestMonitor rm) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fQueue.add(new ItemRequest(index, rm));
- serviceQueue();
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void addListener(final Listener listener) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fListeners.add(listener);
- }
- });
- } catch (RejectedExecutionException e) {}
- }
-
- public void removeListener(final Listener listener) {
- try {
- fExecutor.execute( new DsfRunnable() {
- public void run() {
- fListeners.remove(listener);
- }
- });
- } catch (RejectedExecutionException e) {}
- }
-
- // Main processing function of this generator.
- @ConfinedToDsfExecutor("fExecutor")
- private void serviceQueue() {
-
- for (Iterator requestItr = fQueue.iterator(); requestItr.hasNext();) {
- Request request = requestItr.next();
- if (request.fRequestMonitor.isCanceled()) {
- request.fRequestMonitor.setStatus(
- new Status(IStatus.CANCEL, DsfExamplesPlugin.PLUGIN_ID, "Request canceled"));
- request.fRequestMonitor.done();
- requestItr.remove();
- }
- }
-
- // If a queue servicing is already scheduled, do nothing.
- if (fServiceQueueInProgress) {
- return;
- }
-
- if (fQueue.size() != 0) {
- // If there are requests to service, remove one from the queue and
- // schedule a runnable to process the request after a processing
- // delay.
- fServiceQueueInProgress = true;
- final Request request = fQueue.remove(0);
- fExecutor.schedule(
- new DsfRunnable() {
- public void run() {
- if (request instanceof CountRequest) {
- processCountRequest((CountRequest)request);
- } else if (request instanceof ItemRequest) {
- processItemRequest((ItemRequest)request);
- }
-
- // Reset the processing flag and process next
- // request.
- fServiceQueueInProgress = false;
- serviceQueue();
- }
- },
- PROCESSING_DELAY, TimeUnit.MILLISECONDS);
- }
- }
-
- @ConfinedToDsfExecutor("fExecutor")
- private void processCountRequest(CountRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- rm.setData(fCount);
- rm.done();
- }
-
- @ConfinedToDsfExecutor("fExecutor")
- private void processItemRequest(ItemRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- if (fChangedIndexes.contains(request.fIndex)) {
- rm.setData("Changed: " + request.fIndex);
- } else {
- rm.setData(Integer.toString(request.fIndex));
- }
- rm.done();
- }
-
- /**
- * This method simulates changes in the supplier's data set.
- */
- @ConfinedToDsfExecutor("fExecutor")
- private void randomChanges() {
- // Once every number of changes, reset the count, the rest of the
- // times just change certain values.
- if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0){
- randomCountReset();
- } else {
- randomDataChange();
- }
- }
-
- /**
- * Calculates new size for provider's data set.
- */
- @ConfinedToDsfExecutor("fExecutor")
- private void randomCountReset() {
- // Calculate the new count.
- Random random = new java.util.Random();
- fCount = MIN_COUNT + Math.abs(random.nextInt()) % (MAX_COUNT - MIN_COUNT);
-
- // Reset the changed values.
- fChangedIndexes.clear();
-
- // Notify listeners
- for (Listener listener : fListeners) {
- listener.countChanged();
- }
- }
-
- /**
- * Invalidates a random range of indexes.
- */
- @ConfinedToDsfExecutor("fExecutor")
- private void randomDataChange() {
- // Calculate the indexes to change.
- Random random = new java.util.Random();
- Set set = new HashSet();
- for (int i = 0; i < fCount * RANDOM_CHANGE_SET_PERCENTAGE / 100; i++) {
- set.add( new Integer(Math.abs(random.nextInt()) % fCount) );
- }
-
- // Add the indexes to an overall set of changed indexes.
- fChangedIndexes.addAll(set);
-
- // Notify listeners
- for (Listener listener : fListeners) {
- listener.valuesChanged(set);
- }
- }
-}
-
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/DataGeneratorWithThread.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/DataGeneratorWithThread.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer.answers;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.examples.dsf.DsfExamplesPlugin;
-
-/**
- * Thread-based implementation of the data generator.
- *
- * This generator is based around a queue of client requests and a thread which
- * reads the requests from the queue and processes them. The distinguishing
- * feature of this generator is that it uses a a blocking queue as the main
- * synchronization object. However, fListeners, fShutdown, and fChangedIndexes
- * fields also need to be thread-safe and so they implement their own
- * synchronization.
- *
- */
-public class DataGeneratorWithThread extends Thread implements IDataGenerator {
-
- // Request objects are used to serialize the interface calls into objects
- // which can then be pushed into a queue.
- abstract class Request {
- final RequestMonitor fRequestMonitor;
-
- Request(RequestMonitor rm) {
- fRequestMonitor = rm;
- }
- }
-
- class CountRequest extends Request {
- CountRequest(DataRequestMonitor rm) {
- super(rm);
- }
- }
-
- class ItemRequest extends Request {
- final int fIndex;
- ItemRequest(int index, DataRequestMonitor rm) {
- super(rm);
- fIndex = index;
- }
- }
-
- class ShutdownRequest extends Request {
- ShutdownRequest(RequestMonitor rm) {
- super(rm);
- }
- }
-
- // Main request queue of the data generator. The getValue(), getCount(),
- // and shutdown() methods write into the queue, while the run() method
- // reads from it.
- private final BlockingQueue fQueue = new LinkedBlockingQueue();
-
- // ListenerList class provides thread safety.
- private ListenerList fListeners = new ListenerList();
-
- // Current number of elements in this generator.
- private int fCount = MIN_COUNT;
-
- // Counter used to determine when to reset the element count.
- private int fCountResetTrigger = 0;
-
- // Elements which were modified since the last reset.
- private Set fChangedIndexes = Collections.synchronizedSet(new HashSet());
-
- // Used to determine when to make changes in data.
- private long fLastChangeTime = System.currentTimeMillis();
-
- // Flag indicating when the generator has been shut down.
- private AtomicBoolean fShutdown = new AtomicBoolean(false);
-
- public DataGeneratorWithThread() {
- // Immediately kick off the request processing thread.
- start();
- }
-
- public void shutdown(RequestMonitor rm) {
- // Mark the generator as shut down. After the fShutdown flag is set,
- // all new requests should be shut down.
- if (!fShutdown.getAndSet(true)) {
- fQueue.add(new ShutdownRequest(rm));
- } else {
- //
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getCount(DataRequestMonitor rm) {
- if (!fShutdown.get()) {
- fQueue.add(new CountRequest(rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void getValue(int index, DataRequestMonitor rm) {
- if (!fShutdown.get()) {
- fQueue.add(new ItemRequest(index, rm));
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
- rm.done();
- }
- }
-
- public void addListener(Listener listener) {
- fListeners.add(listener);
- }
-
- public void removeListener(Listener listener) {
- fListeners.remove(listener);
- }
-
- @Override
- public void run() {
- try {
- while(true) {
- // Get the next request from the queue. The time-out
- // ensures that that the random changes get processed.
- final Request request = fQueue.poll(100, TimeUnit.MILLISECONDS);
-
- // If a request was dequeued, process it.
- if (request != null) {
- // Simulate a processing delay.
- Thread.sleep(PROCESSING_DELAY);
-
- if (request instanceof CountRequest) {
- processCountRequest((CountRequest)request);
- } else if (request instanceof ItemRequest) {
- processItemRequest((ItemRequest)request);
- } else if (request instanceof ShutdownRequest) {
- // If shutting down, just break out of the while(true)
- // loop and thread will exit.
- request.fRequestMonitor.done();
- break;
- }
- }
-
- // Simulate data changes.
- randomChanges();
- }
- }
- catch (InterruptedException x) {}
- }
-
- private void processCountRequest(CountRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- rm.setData(fCount);
- rm.done();
- }
-
- private void processItemRequest(ItemRequest request) {
- @SuppressWarnings("unchecked") // Suppress warning about lost type info.
- DataRequestMonitor rm = (DataRequestMonitor)request.fRequestMonitor;
-
- if (fChangedIndexes.contains(request.fIndex)) {
- rm.setData("Changed: " + request.fIndex);
- } else {
- rm.setData(Integer.toString(request.fIndex));
- }
- rm.done();
- }
-
-
- private void randomChanges() {
- // Check if enough time is elapsed.
- if (System.currentTimeMillis() > fLastChangeTime + RANDOM_CHANGE_INTERVAL) {
- fLastChangeTime = System.currentTimeMillis();
-
- // Once every number of changes, reset the count, the rest of the
- // times just change certain values.
- if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0){
- randomCountReset();
- } else {
- randomDataChange();
- }
- }
- }
-
- private void randomCountReset() {
- // Calculate the new count.
- Random random = new java.util.Random();
- fCount = MIN_COUNT + Math.abs(random.nextInt()) % (MAX_COUNT - MIN_COUNT);
-
- // Reset the changed values.
- fChangedIndexes.clear();
-
- // Notify listeners
- for (Object listener : fListeners.getListeners()) {
- ((Listener)listener).countChanged();
- }
- }
-
- private void randomDataChange() {
- // Calculate the indexes to change.
- Random random = new java.util.Random();
- Set set = new HashSet();
- for (int i = 0; i < fCount * RANDOM_CHANGE_SET_PERCENTAGE / 100; i++) {
- set.add( new Integer(Math.abs(random.nextInt()) % fCount) );
- }
-
- // Add the indexes to an overall set of changed indexes.
- fChangedIndexes.addAll(set);
-
- // Notify listeners
- for (Object listener : fListeners.getListeners()) {
- ((Listener)listener).valuesChanged(set);
- }
- }
-}
-
-
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/IDataGenerator.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/IDataGenerator.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer.answers;
-
-import java.util.Set;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
-
-/**
- * Data generator is simple source of data used to populate the example table
- * view. It contains two asynchronous methods for retrieving the data
- * parameters: the count and the value for a given index. It also allows the
- * view to receive events indicating when the data supplied by the generator
- * is changed.
- */
-@ThreadSafe
-public interface IDataGenerator {
-
- // Constants which control the data generator behavior.
- // Changing the count range can stress the scalability of the system, while
- // changing of the process delay and random change interval can stress
- // its performance.
- final static int MIN_COUNT = 100;
- final static int MAX_COUNT = 200;
- final static int PROCESSING_DELAY = 10;
- final static int RANDOM_CHANGE_INTERVAL = 10000;
- final static int RANDOM_COUNT_CHANGE_INTERVALS = 3;
- final static int RANDOM_CHANGE_SET_PERCENTAGE = 10;
-
-
- // Listener interface that the view needs to implement to react
- // to the changes in data.
- public interface Listener {
- void countChanged();
- void valuesChanged(Set indexes);
- }
-
- // Data access methods.
- void getCount(DataRequestMonitor rm);
- void getValue(int index, DataRequestMonitor rm);
-
- // Method used to shutdown the data generator including any threads that
- // it may use.
- void shutdown(RequestMonitor rm);
-
- // Methods for registering change listeners.
- void addListener(Listener listener);
- void removeListener(Listener listener);
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/SyncDataViewer.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/dataviewer/answers/SyncDataViewer.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.dataviewer.answers;
-
-import java.util.Set;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.Query;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Data viewer based on a table, which reads data using synchronous methods.
- *
- * This viewer implements the {@link IStructuredContentProvider} interface
- * which is used by the JFace TableViewer class to populate a Table. This
- * interface contains one principal methods for reading data {@link #getElements(Object)},
- * which synchronously returns an array of elements. In order to implement this
- * method using the asynchronous data generator, this provider uses the
- * {@link Query} object.
- *
- */
-public class SyncDataViewer
- implements IStructuredContentProvider, IDataGenerator.Listener
-{
- // The viewer and generator that this content provider using.
- final private TableViewer fViewer;
- final private IDataGenerator fDataGenerator;
-
- public SyncDataViewer(TableViewer viewer, IDataGenerator generator) {
- fViewer = viewer;
- fDataGenerator = generator;
- fDataGenerator.addListener(this);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // Not used
- }
-
-
- public Object[] getElements(Object inputElement) {
-
- // Create the query object for reading data count.
- Query countQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- fDataGenerator.getCount(rm);
- }
- };
-
- // Submit the query to be executed. A query implements a runnable
- // interface and it has to be executed in order to do its work.
- ImmediateExecutor.getInstance().execute(countQuery);
- int count = 0;
-
- // Block until the query completes, which will happen when the request
- // monitor of the execute() method is marked done.
- try {
- count = countQuery.get();
- } catch (Exception e) {
- // InterruptedException and ExecutionException can be thrown here.
- // ExecutionException containing a CoreException will be thrown
- // if an error status is set to the Query's request monitor.
- return new Object[0];
- }
-
- // Create the array that will be filled with elements.
- // For each index in the array execute a query to get the element at
- // that index.
- final Object[] elements = new Object[count];
-
- for (int i = 0; i < count; i++) {
- final int index = i;
- Query valueQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- fDataGenerator.getValue(index, rm);
- }
- };
- ImmediateExecutor.getInstance().execute(valueQuery);
- try {
- elements[i] = valueQuery.get();
- } catch (Exception e) {
- elements[i] = "error";
- }
- }
- return elements;
- }
-
- public void dispose() {
- fDataGenerator.removeListener(this);
- }
-
- public void countChanged() {
- // For any event from the generator, refresh the whole viewer.
- refreshViewer();
- }
-
- public void valuesChanged(Set indexes) {
- // For any event from the generator, refresh the whole viewer.
- refreshViewer();
- }
-
- private void refreshViewer() {
- getElements(null);
-
- // This method may be called on any thread, switch to the display
- // thread before calling the viewer.
- Display display = fViewer.getControl().getDisplay();
- display.asyncExec( new Runnable() {
- public void run() {
- if (!fViewer.getControl().isDisposed()) {
- fViewer.refresh();
- }
- }
- });
- }
-
- public static void main(String[] args) {
- // Create the shell to hold the viewer.
- Display display = new Display();
- Shell shell = new Shell(display, SWT.SHELL_TRIM);
- shell.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- shell.setLayoutData(data);
- Font font = new Font(display, "Courier", 10, SWT.NORMAL);
-
- // Create the table viewer.
- TableViewer tableViewer = new TableViewer(shell, SWT.BORDER);
- tableViewer.getControl().setLayoutData(data);
-
- // Create the data generator.
- final IDataGenerator generator = new DataGeneratorWithExecutor();
-
- // Create the content provider which will populate the viewer.
- SyncDataViewer contentProvider = new SyncDataViewer(tableViewer, generator);
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(new Object());
-
- // Open the shell and service the display dispatch loop until user
- // closes the shell.
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // The IDataGenerator.shutdown() method is asynchronous, this requires
- // using a query again in order to wait for its completion.
- Query shutdownQuery = new Query() {
- @Override
- protected void execute(DataRequestMonitor rm) {
- generator.shutdown(rm);
- }
- };
- ImmediateExecutor.getInstance().execute(shutdownQuery);
- try {
- shutdownQuery.get();
- } catch (Exception e) {}
-
- // Shut down the display.
- font.dispose();
- display.dispose();
- }
-
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/Async2Plus2.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/Async2Plus2.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor;
-
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-
-/**
- * Example of using a DataRequestMonitor to retrieve a result from an
- * asynchronous method.
- */
-public class Async2Plus2 {
-
- public static void main(String[] args) {
- Executor executor = ImmediateExecutor.getInstance();
- DataRequestMonitor rm =
- new DataRequestMonitor(executor, null) {
- @Override
- protected void handleCompleted() {
- System.out.println("2 + 2 = " + getData());
- }
- };
- asyncAdd(2, 2, rm);
- }
-
- static void asyncAdd(int value1, int value2, DataRequestMonitor rm) {
- rm.setData(value1 + value2);
- rm.done();
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/AsyncHelloWorld.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/AsyncHelloWorld.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor;
-
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-
-/**
- * "Hello world" example which uses an asynchronous method to print out
- * the result.
- *
- * The main method uses an immediate executor, which executes runnables
- * as soon as they are submitted, in creating its request monitor.
- *
- */
-public class AsyncHelloWorld {
-
- public static void main(String[] args) {
- Executor executor = ImmediateExecutor.getInstance();
- RequestMonitor rm = new RequestMonitor(executor, null);
- asyncHelloWorld(rm);
- }
-
- static void asyncHelloWorld(RequestMonitor rm) {
- System.out.println("Hello world");
- // TODO Exercise 1: - Call the second async. "Hello world 2" method.
- // Hint: Calling an asynchronous method requires passing to it a
- // request monitor. A new request monitor can be constructed with
- // a parent RequestMonitor as an argument argument. The parent gets
- // completed automatically when the lower level request monitor is
- // completed.
- rm.done();
- }
-
- // TODO: Exercise 1 - Add a second async. "Hello world 2" method.
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/AsyncQuicksort.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/AsyncQuicksort.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor;
-
-import java.util.Arrays;
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-
-/**
- * Example of using a CountingRequestMonitor to wait for multiple
- * asynchronous calls to complete.
- */
-public class AsyncQuicksort {
-
- static Executor fgExecutor = ImmediateExecutor.getInstance();
-
- public static void main(String[] args) {
- final int[] array = {5, 7, 8, 3, 2, 1, 9, 5, 4};
-
- System.out.println("To sort: " + Arrays.toString(array));
- asyncQuicksort(
- array, 0, array.length - 1,
- new RequestMonitor(fgExecutor, null) {
- @Override
- protected void handleCompleted() {
- System.out.println("Sorted: " + Arrays.toString(array));
- }
- });
- }
-
- static void asyncQuicksort(final int[] array, final int left,
- final int right, final RequestMonitor rm)
- {
- if (right > left) {
- int pivot = left;
- // TODO: Exercise 2 - Convert the call to partition into an
- // asynchronous call to asyncPartition().
- // Hint: The rest of the code below should be executed inside
- // the DataRequestMonitor.handleCompleted() overriding method.
- int newPivot = partition(array, left, right, pivot);
- printArray(array, left, right, newPivot);
-
- CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
- asyncQuicksort(array, left, newPivot - 1, countingRm);
- asyncQuicksort(array, newPivot + 1, right, countingRm);
- countingRm.setDoneCount(2);
- } else {
- rm.done();
- }
- }
-
- // TODO Exercise 2 - Convert partition to an asynchronous method.
- // Hint: a DataRequestMonitor should be used to carry the
- // return value to the caller.
- static int partition(int[] array, int left, int right, int pivot)
- {
- int pivotValue = array[pivot];
- array[pivot] = array[right];
- array[right] = pivotValue;
- int store = left;
- for (int i = left; i < right; i++) {
- if (array[i] <= pivotValue) {
- int tmp = array[store];
- array[store] = array[i];
- array[i] = tmp;
- store++;
- }
- }
- array[right] = array[store];
- array[store] = pivotValue;
-
- // TODO: Request Monitors Exercise 2 - Return the data to caller using
- // a request monitor.
- return store;
- }
-
- static void printArray(int[] array, int left, int right, int pivot) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < array.length; i++ ) {
- if (i == left) {
- buffer.append('>');
- } else if (i == pivot) {
- buffer.append('-');
- } else {
- buffer.append(' ');
- }
- buffer.append(array[i]);
-
- if (i == right) {
- buffer.append('<');
- } else if (i == pivot) {
- buffer.append('-');
- } else {
- buffer.append(' ');
- }
- }
-
- System.out.println(buffer);
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/Async2Plus2.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/Async2Plus2.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
-
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-
-/**
- * Example of using a DataRequestMonitor to retrieve a result from an
- * asynchronous method.
- */
-public class Async2Plus2 {
-
- public static void main(String[] args) {
- Executor executor = ImmediateExecutor.getInstance();
- DataRequestMonitor rm =
- new DataRequestMonitor(executor, null) {
- @Override
- protected void handleCompleted() {
- System.out.println("2 + 2 = " + getData());
- }
- };
- asyncAdd(2, 2, rm);
- }
-
- static void asyncAdd(int value1, int value2, DataRequestMonitor rm) {
- rm.setData(value1 + value2);
- rm.done();
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/AsyncHelloWorld.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/AsyncHelloWorld.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
-
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-
-/**
- * "Hello world" example which uses an asynchronous method to print out
- * the result.
- *
- * The main method uses an immediate executor, which executes runnables
- * as soon as they are submitted, in creating its request monitor.
- *
- */
-public class AsyncHelloWorld {
-
- public static void main(String[] args) {
- Executor executor = ImmediateExecutor.getInstance();
- RequestMonitor rm = new RequestMonitor(executor, null);
- asyncHelloWorld(rm);
- }
-
- static void asyncHelloWorld(RequestMonitor rm) {
- System.out.println("Hello world");
- RequestMonitor rm2 = new RequestMonitor(ImmediateExecutor.getInstance(), rm);
- asyncHelloWorld2(rm2);
- }
-
- static void asyncHelloWorld2(RequestMonitor rm) {
- System.out.println("Hello world 2");
- rm.done();
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/AsyncQuicksort.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/requestmonitor/answers/AsyncQuicksort.java Tue Aug 04 14:00:13 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
-
-import java.util.Arrays;
-import java.util.concurrent.Executor;
-
-import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-
-/**
- * Example of using a CountingRequestMonitor to wait for multiple
- * asynchronous calls to complete.
- */
-public class AsyncQuicksort {
-
- static Executor fgExecutor = ImmediateExecutor.getInstance();
-
- public static void main(String[] args) {
- final int[] array = {5, 7, 8, 3, 2, 1, 9, 5, 4};
-
- System.out.println("To sort: " + Arrays.toString(array));
- asyncQuicksort(
- array, 0, array.length - 1,
- new RequestMonitor(fgExecutor, null) {
- @Override
- protected void handleCompleted() {
- System.out.println("Sorted: " + Arrays.toString(array));
- }
- });
- }
-
- static void asyncQuicksort(final int[] array, final int left,
- final int right, final RequestMonitor rm)
- {
- if (right > left) {
- int pivot = left;
- asyncPartition(
- array, left, right, pivot,
- new DataRequestMonitor(fgExecutor, rm) {
- @Override
- protected void handleCompleted() {
- int newPivot = getData();
- printArray(array, left, right, newPivot);
-
- CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
- asyncQuicksort(array, left, newPivot - 1, countingRm);
- asyncQuicksort(array, newPivot + 1, right, countingRm);
- countingRm.setDoneCount(2);
- }
- });
- } else {
- rm.done();
- }
- }
-
- static void asyncPartition(int[] array, int left, int right, int pivot, DataRequestMonitor rm)
- {
- int pivotValue = array[pivot];
- array[pivot] = array[right];
- array[right] = pivotValue;
- int store = left;
- for (int i = left; i < right; i++) {
- if (array[i] <= pivotValue) {
- int tmp = array[store];
- array[store] = array[i];
- array[i] = tmp;
- store++;
- }
- }
- array[right] = array[store];
- array[store] = pivotValue;
-
- // Java 5 automatically converts the int type of the store variable
- // to an Integer object.
- rm.setData(store);
- rm.done();
- }
-
- static void printArray(int[] array, int left, int right, int pivot) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < array.length; i++ ) {
- if (i == left) {
- buffer.append('>');
- } else if (i == pivot) {
- buffer.append('-');
- } else {
- buffer.append(' ');
- }
- buffer.append(array[i]);
-
- if (i == right) {
- buffer.append('<');
- } else if (i == pivot) {
- buffer.append('-');
- } else {
- buffer.append(' ');
- }
- }
-
- System.out.println(buffer);
- }
-}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesShutdownSequence.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesShutdownSequence.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesShutdownSequence.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Wind River Systems and others.
+ * Copyright (c) 2006, 2008 Wind River 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
@@ -25,7 +25,7 @@
*/
public class ServicesShutdownSequence extends Sequence {
- // Session that the services are running in.
+ // Session to that the services are running in.
final private DsfSession fSession;
// DSF Services is created as the first step of the sequence. It
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TimersVMProvider.java Wed Aug 05 17:35:39 2009 -0500
@@ -42,55 +42,12 @@
/** Enumeration of possible layouts for the timers view model */
public enum ViewLayout { TRIGGERS_AT_TOP, TIMERS_AT_TOP }
- /** Have we registered ourselves as a listener for DM events? */
- private boolean fRegisteredEventListener;
-
public TimersVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
super(adapter, presentationContext, session);
-
- // Add ourselves as listener for DM events events.
- try {
- session.getExecutor().execute(new Runnable() {
- public void run() {
- if (DsfSession.isSessionActive(getSession().getId())) {
- getSession().addServiceEventListener(TimersVMProvider.this, null);
- fRegisteredEventListener = true;
- }
- }
- });
- } catch (RejectedExecutionException e) {
- // Session shut down, not much we can do but wait to be disposed.
- }
-
// Set the initial view layout.
setViewLayout(ViewLayout.TIMERS_AT_TOP);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider#dispose()
- */
- @Override
- public void dispose() {
- // Remove ourselves as listener for DM events events. In practice, we
- // get called after the session has shut down, so we'll end up with a
- // RejectedExecutionException. We put this here all the same for
- // completeness sake.
- try {
- getSession().getExecutor().execute(new Runnable() {
- public void run() {
- if (fRegisteredEventListener && DsfSession.isSessionActive(getSession().getId())) {
- getSession().removeServiceEventListener(TimersVMProvider.this);
- fRegisteredEventListener = false;
- }
- }
- });
- } catch (RejectedExecutionException e) {
- // Session shut down, not much we can do but wait to be disposed.
- }
-
- super.dispose();
- }
-
/**
* Configures a new layout for the timers view model.
* @param layout New layout to use.
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.gnu.dsf-feature/feature.xml
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.gnu.dsf-feature/feature.xml Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.gnu.dsf-feature/feature.xml Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java Wed Aug 05 17:35:39 2009 -0500
@@ -136,10 +136,6 @@
private List orderedProjects;
private String preLaunchBuildConfiguration;
- /**
- * Used in conjunction with build before launch settings in the main tab.
- */
- private boolean buildForLaunchCalled;
abstract public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException;
@@ -595,24 +591,11 @@
* @return whether the debug platform should perform an incremental
* workspace build before the launch
* @throws CoreException
- * if an exception occurs while building
+ * if an exception occurrs while building
*/
@Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
-
- buildForLaunchCalled = true;
-
- // check the build before launch setting and honor it
- int buildBeforeLaunchValue = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
- ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING);
-
- // we shouldn't be getting called if the workspace setting is disabled, so assume we need to
- // build unless the user explicitly disabled it in the main tab of the launch.
- if (buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED) {
- return false;
- }
-
- //This matches the old code, but I don't know that it is the right behavior.
+ //This matches the old code, but I don't know that it is the right behaviour.
//We should be building the local project as well, not just the ordered projects
if(orderedProjects == null) {
return false;
@@ -683,26 +666,6 @@
*/
@Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
-
- if (!buildForLaunchCalled) {
- // buildForLaunch was not called which means that the workspace pref is disabled. see if the user enabled the
- // launch specific setting in the main tab. if so, we do call buildBeforeLaunch here.
- if (ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED == configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
- ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING)) {
-
- IProgressMonitor buildMonitor = new SubProgressMonitor(monitor, 10, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- buildMonitor.beginTask(LaunchMessages.getString("AbstractCLaunchDelegate.BuildBeforeLaunch"), 10); //$NON-NLS-1$
- buildMonitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.PerformingBuild")); //$NON-NLS-1$
- if (buildForLaunch(configuration, mode, new SubProgressMonitor(buildMonitor, 7))) {
- buildMonitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.PerformingIncrementalBuild")); //$NON-NLS-1$
- ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(buildMonitor, 3));
- }
- else {
- buildMonitor.worked(3); /* No incremental build required */
- }
- }
- }
-
boolean continueLaunch = true;
if(orderedProjects == null) {
return continueLaunch;
@@ -807,8 +770,6 @@
monitor = new NullProgressMonitor();
}
- buildForLaunchCalled = false;
-
int scale = 1000;
int totalWork = 2 * scale;
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties Wed Aug 05 17:35:39 2009 -0500
@@ -30,9 +30,6 @@
AbstractCLaunchDelegate.searching_for_errors_in=Searching for compile errors in
AbstractCLaunchDelegate.20=Building prerequisite project list
AbstractCLaunchDelegate.Program_is_not_a_recongnized_executable=Program is not a recognized executable.
-AbstractCLaunchDelegate.BuildBeforeLaunch=Build before launch -
-AbstractCLaunchDelegate.PerformingBuild=Performing required build...
-AbstractCLaunchDelegate.PerformingIncrementalBuild=Performing incremental workspace build...
LocalRunLaunchDelegate.Launching_Local_C_Application=Launching Local C/C++ Application
LocalRunLaunchDelegate.Failed_setting_runtime_option_though_debugger=Failed to set program arguments, environment or working directory.
@@ -89,15 +86,6 @@
CMainTab.Use_Active=Use Active
#For CMainTab.Configuration_name: {0} - project name; {1} - configuration name
CMainTab.Configuration_name={0} {1}
-CMainTab.Build_options=Build (if required) before launching
-CMainTab.Disable_build_button_label=Disable auto build
-CMainTab.Disable_build_button_tooltip=Requires manually building project before launching (this may improve launch performance)
-CMainTab.Enable_build_button_label=Enable auto build
-CMainTab.Enable_build_button_tooltip=Always build project before launching (this may impact launch performance)
-CMainTab.Workspace_settings_button_label=Use workspace settings
-CMainTab.Workspace_settings_button_tooltip=Use workspace settings
-CMainTab.Workspace_settings_link_label=Configure Workspace Settings...
-CMainTab.Workspace_settings_page_id=org.eclipse.debug.ui.LaunchingPreferencePage
CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
CDebuggerTab.Stop_at_main_on_startup=Stop on startup at:
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java Wed Aug 05 17:35:39 2009 -0500
@@ -66,12 +66,9 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
/**
@@ -117,11 +114,6 @@
* @since 6.0
*/
protected Combo fBuildConfigCombo;
- // Build option UI widgets
- protected Button fDisableBuildButton;
- protected Button fEnableBuildButton;
- protected Button fWorkspaceSettingsButton;
- protected Link fWorkpsaceSettingsLink;
private final boolean fWantsTerminalOption;
protected Button fTerminalButton;
@@ -172,7 +164,6 @@
createVerticalSpacer(comp, 1);
createProjectGroup(comp, 1);
createBuildConfigCombo(comp, 1);
- createBuildOptionGroup(comp, 1);
createExeFileGroup(comp, 1);
createVerticalSpacer(comp, 1);
if (fSpecifyCoreFile) {
@@ -329,65 +320,6 @@
});
}
- protected void createBuildOptionGroup(final Composite parent, int colSpan) {
- Group buildGroup = new Group(parent, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = colSpan;
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginHeight = 5;
- gridLayout.marginWidth = 5;
- gridLayout.makeColumnsEqualWidth= true;
- buildGroup.setLayoutData(gridData);
- buildGroup.setLayout(gridLayout);
- buildGroup.setText("Build (if required) before launching"); //$NON-NLS-1$
-
- fDisableBuildButton = new Button(buildGroup, SWT.RADIO);
- fDisableBuildButton.setText(LaunchMessages.getString("CMainTab.Disable_build_button_label")); //$NON-NLS-1$
- fDisableBuildButton.setToolTipText(LaunchMessages.getString("CMainTab.Disable_build_button_tooltip")); //$NON-NLS-1$
- fDisableBuildButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- new Label(buildGroup, SWT.NONE);
-
- fEnableBuildButton = new Button(buildGroup, SWT.RADIO);
- fEnableBuildButton.setText(LaunchMessages.getString("CMainTab.Enable_build_button_label")); //$NON-NLS-1$
- fEnableBuildButton.setToolTipText(LaunchMessages.getString("CMainTab.Enable_build_button_tooltip")); //$NON-NLS-1$
- fEnableBuildButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- new Label(buildGroup, SWT.NONE);
-
- fWorkspaceSettingsButton = new Button(buildGroup, SWT.RADIO);
- fWorkspaceSettingsButton.setText(LaunchMessages.getString("CMainTab.Workspace_settings_button_label")); //$NON-NLS-1$
- fWorkspaceSettingsButton.setToolTipText(LaunchMessages.getString("CMainTab.Workspace_settings_button_tooltip")); //$NON-NLS-1$
- fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- fWorkpsaceSettingsLink = new Link(buildGroup, SWT.NONE); //$NON-NLS-1$
- fWorkpsaceSettingsLink.setText(LaunchMessages.getString("CMainTab.Workspace_settings_link_label")); //$NON-NLS-1$
- fWorkpsaceSettingsLink.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- PreferencesUtil.createPreferenceDialogOn(
- parent.getShell(),
- LaunchMessages.getString("CMainTab.Workspace_settings_page_id"), //$NON-NLS-1$
- null,
- null).open();
- }
- });
- }
/** @since 6.0 */
protected void createCoreFileGroup(Composite parent, int colSpan) {
Composite coreComp = new Composite(parent, SWT.NONE);
@@ -463,7 +395,6 @@
updateProjectFromConfig(config);
updateProgramFromConfig(config);
updateCoreFromConfig(config);
- updateBuildOptionFromConfig(config);
updateTerminalFromConfig(config);
}
@@ -493,16 +424,13 @@
}
protected void updateProgramFromConfig(ILaunchConfiguration config) {
- if (fProgText != null)
- {
- String programName = EMPTY_STRING;
- try {
- programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
- } catch (CoreException ce) {
- LaunchUIPlugin.log(ce);
- }
- fProgText.setText(programName);
+ String programName = EMPTY_STRING;
+ try {
+ programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
+ } catch (CoreException ce) {
+ LaunchUIPlugin.log(ce);
}
+ fProgText.setText(programName);
}
/** @since 6.0 */
@@ -514,23 +442,10 @@
} catch (CoreException ce) {
LaunchUIPlugin.log(ce);
}
- fProgText.setText(coreName);
+ fCoreText.setText(coreName);
}
}
-
- protected void updateBuildOptionFromConfig(ILaunchConfiguration config) {
- int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
- try {
- buildBeforeLaunchValue = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
- } catch (CoreException e) {
- LaunchUIPlugin.log(e);
- }
-
- fDisableBuildButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
- fEnableBuildButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED);
- fWorkspaceSettingsButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING);
- }
-
+
/*
* (non-Javadoc)
*
@@ -549,28 +464,14 @@
config.setMappedResources(null);
}
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
- if (fBuildConfigCombo != null) {
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
- }
- if (fProgText != null) {
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
- }
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
if (fCoreText != null) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText());
}
if (fTerminalButton != null) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection());
}
-
- if (fDisableBuildButton != null) {
- int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
- if (fDisableBuildButton.getSelection()) {
- buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED;
- } else if (fEnableBuildButton.getSelection()) {
- buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED;
- }
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
- }
}
/**
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.make.ui; singleton:=true
-Bundle-Version: 6.1.0.qualifier
+Bundle-Version: 6.0.1.qualifier
Bundle-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java Wed Aug 05 17:35:39 2009 -0500
@@ -59,6 +59,8 @@
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
@@ -124,7 +126,18 @@
handleSelectionChanged(event);
}
});
+ fViewer.getControl().addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ handleDeleteKeyPressed();
+ }
+ }
+ });
+
+ fViewer.setContentProvider(new MakeContentProvider());
+ fViewer.setLabelProvider(new MakeLabelProvider());
fViewer.setSorter(new ViewerSorter() {
@Override
@@ -332,6 +345,10 @@
// manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
+ protected void handleDeleteKeyPressed() {
+ deleteTargetAction.run();
+ }
+
protected void handleDoubleClick(DoubleClickEvent event) {
buildTargetAction.run();
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/makefile
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/makefile Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/makefile Wed Aug 05 17:35:39 2009 -0500
@@ -1,43 +1,43 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-ROOT := ..
-
--include $(ROOT)/makefile.init
-
-RM := rm -rf
-
-# All of the sources participating in the build are defined here
--include sources.mk
--include $(SUBDIRS:%=%/subdir.mk)
--include objects.mk
-ifneq ($(strip $(DEPS)),)
--include $(DEPS)
-endif
-
--include $(ROOT)/makefile.defs
-
-# Add inputs and outputs from these tool invocations to the build variables
-
-# All Target
-all: lib.a
-
-# Tool invocations
-lib.a: $(OBJS) $(USER_OBJS)
- @echo 'Building target: $@'
- @echo 'Invoking: MBS30.archiver.gnu'
- @echo ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
- @ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
- @echo 'Finished building target: $@'
- @echo ' '
-
-# Other Targets
-clean:
- -$(RM) $(OBJS)$(ARCHIVES)$(DEPS) lib.a
- -@echo ' '
-
-.PHONY: all clean dependents
-.SECONDARY:
-
--include $(ROOT)/makefile.targets
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+ROOT := ..
+
+-include $(ROOT)/makefile.init
+
+RM := rm -rf
+
+# All of the sources participating in the build are defined here
+-include sources.mk
+-include $(SUBDIRS:%=%/subdir.mk)
+-include objects.mk
+ifneq ($(strip $(DEPS)),)
+-include $(DEPS)
+endif
+
+-include $(ROOT)/makefile.defs
+
+# Add inputs and outputs from these tool invocations to the build variables
+
+# All Target
+all: lib.a
+
+# Tool invocations
+lib.a: $(OBJS) $(USER_OBJS)
+ @echo 'Building target: $@'
+ @echo 'Invoking: MBS30.archiver.gnu'
+ @echo ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
+ @ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
+ @echo 'Finished building target: $@'
+ @echo ' '
+
+# Other Targets
+clean:
+ -$(RM) $(OBJS)$(ARCHIVES)$(DEPS) lib.a
+ -@echo ' '
+
+.PHONY: all clean dependents
+.SECONDARY:
+
+-include $(ROOT)/makefile.targets
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/objects.mk
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/objects.mk Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/objects.mk Wed Aug 05 17:35:39 2009 -0500
@@ -1,7 +1,7 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-LIBS :=
-
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+LIBS :=
+
USER_OBJS :=
\ No newline at end of file
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/sources.mk
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/sources.mk Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/sources.mk Wed Aug 05 17:35:39 2009 -0500
@@ -1,14 +1,14 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-C_SRCS :=
-O_SRCS :=
-OBJS :=
-ARCHIVES :=
-DEPS :=
-
-# Every subdirectory with source files must be described here
-SUBDIRS := \
-. \
-
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+C_SRCS :=
+O_SRCS :=
+OBJS :=
+ARCHIVES :=
+DEPS :=
+
+# Every subdirectory with source files must be described here
+SUBDIRS := \
+. \
+
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/subdir.mk
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/subdir.mk Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/linkedFolder/Benchmarks/subdir.mk Wed Aug 05 17:35:39 2009 -0500
@@ -1,34 +1,34 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-# Add inputs and outputs from these tool invocations to the build variables
-C_SRCS += \
-$(ROOT)/f1.c \
-$(ROOT)/f2.c
-
-OBJS += \
-${addprefix ./, \
-f1.o \
-f2.o \
-}
-
-DEPS += \
-${addprefix ./, \
-f1.d \
-f2.d \
-}
-
-
-# Each subdirectory must supply rules for building sources it contributes
-%.o: $(ROOT)/%.c
- @echo 'Building file: $<'
- @echo 'Invoking: MBS30.compiler.gnu.c'
- @echo gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $<
- @gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $< && \
- echo -n $(@:%.o=%.d) $(dir $@) > $(@:%.o=%.d) && \
- gcc -MM -MG -P -w -O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
- @echo 'Finished building: $<'
- @echo ' '
-
-
+################################################################################
+# Automatically-generated file. Do not edit!
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+C_SRCS += \
+$(ROOT)/f1.c \
+$(ROOT)/f2.c
+
+OBJS += \
+${addprefix ./, \
+f1.o \
+f2.o \
+}
+
+DEPS += \
+${addprefix ./, \
+f1.d \
+f2.d \
+}
+
+
+# Each subdirectory must supply rules for building sources it contributes
+%.o: $(ROOT)/%.c
+ @echo 'Building file: $<'
+ @echo 'Invoking: MBS30.compiler.gnu.c'
+ @echo gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $<
+ @gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $< && \
+ echo -n $(@:%.o=%.d) $(dir $@) > $(@:%.o=%.d) && \
+ gcc -MM -MG -P -w -O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
+ @echo 'Finished building: $<'
+ @echo ' '
+
+
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedOptionValueHandler.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedOptionValueHandler.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedOptionValueHandler.java Wed Aug 05 17:35:39 2009 -0500
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 Symbian Ltd and others.
+ * Copyright (c) 2005, 2007 Symbian Ltd 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
@@ -11,121 +11,104 @@
package org.eclipse.cdt.managedbuilder.core;
/**
- * This interface represents an option value handler in the managed build
+ * This interface represents an option value handler in the managed build
* system. It is used to enable a tool integrator to use the MBS configuration
* GUI, while linking to an alternative back-end.
*
* @since 3.0
*/
-public interface IManagedOptionValueHandler {
-
- /**
- * The option is opened, i.e. its UI element is created. The valueHandler
- * can override the value of the option. If it does not, the last persisted
- * value is used.
- */
- public final int EVENT_OPEN = 1;
-
- /**
- * The option is closed. i.e. its value has been destroyed when a
- * configuration/resource gets deleted. The value handler can do various
- * things associated with destroying the option such as freeing the memory
- * associated with this option callback, if needed.
- */
- public final int EVENT_CLOSE = 2;
+public interface IManagedOptionValueHandler{
- /**
- * The default value option::defaultValue has been set. The handleValue
- * callback is called afterwards to give the handler a chance to override
- * the value or to update the value in its back-end. Typically this event
- * will be called when the Restore Defaults button is pressed.
- */
- public final int EVENT_SETDEFAULT = 3;
-
- /**
- * The option has been set by pressing the Apply button (or the OK button).
- * The valueHandler can transfer the value of the option to its own
- * back-end.
- */
- public final int EVENT_APPLY = 4;
-
- /**
- * Posted when the managed build extensions (defined in the manifest files)
- * are loaded. The handler is allowed to adjust the extension elements
- */
- public final int EVENT_LOAD = 5;
+ public final int EVENT_OPEN = 1; /** The option is opened, i.e. its UI element
+ * is created. The valueHandler can override
+ * the value of the option. If it does not,
+ * the last persisted value is used. */
+ public final int EVENT_CLOSE = 2; /** The option is closed. i.e. its value has been
+ * destroyed when a configuration/resource gets deleted.
+ * The valuehandler can do various things assocaited with
+ * destroying the option such as freeing the memory
+ * associated with this option callback, if needed. */
+ public final int EVENT_SETDEFAULT = 3; /** The default value option::defaultValue has
+ * been set. The handleValue callback is called
+ * afterwards to give the handler a chance to
+ * override the value or to update the value in
+ * its back-end. Typically this event will be called
+ * when the Restore Defaults button is pressed. */
+ public final int EVENT_APPLY = 4; /** The option has been set by pressing the Apply
+ * button (or the OK button). The valueHandler can
+ * transfer the value of the option to its own
+ * back-end. */
+ public final int EVENT_LOAD = 5; /** Posted when the managed build extensions (defined in the manifest files)
+ * are loadded.
+ * The handler is allowed to adjust the extension elements
+ */
+
+/**
+ * Handles transfer between values between UI element and
+ * back-end in different circumstances.
+ *
+ * @param configuration build configuration of option
+ * (may be IConfiguration or IResourceConfiguration)
+ * @param holder contains the holder of the option
+ * @param option the option that is handled
+ * @param extraArgument extra argument for handler
+ * @param event event to be handled
+ *
+ * @return True when the event was handled, false otherwise.
+ * This enables default event handling can take place.
+ */
+boolean handleValue(IBuildObject configuration,
+ IHoldsOptions holder,
+ IOption option,
+ String extraArgument,
+ int event);
- /**
- * Handles transfer between values between UI element and back-end in
- * different circumstances.
- *
- * @param configuration
- * build configuration of option (may be IConfiguration or
- * IResourceConfiguration)
- * @param holder
- * contains the holder of the option
- * @param option
- * the option that is handled
- * @param extraArgument
- * extra argument for handler
- * @param event
- * event to be handled
- *
- * @return True when the event was handled, false otherwise. This enables
- * default event handling can take place.
- */
- boolean handleValue(IBuildObject configuration, IHoldsOptions holder,
- IOption option, String extraArgument, int event);
+/**
+ * Checks whether the value of an option is its default value.
+ *
+ * @param configuration build configuration of option
+ * (may be IConfiguration or IResourceConfiguration)
+ * @param holder contains the holder of the option
+ * @param option the option that is handled
+ * @param extraArgument extra argument for handler
+ *
+ * The additional options besides configuration are supplied to
+ * provide enough information for querying the default value from
+ * a potential data storage back-end.
+ *
+ * @return True if the options value is its default value and
+ * False otherwise. This enables that default event handling can
+ * take place.
+ */
+boolean isDefaultValue(IBuildObject configuration,
+ IHoldsOptions holder,
+ IOption option,
+ String extraArgument);
- /**
- * Checks whether the value of an option is its default value.
- *
- * @param configuration
- * build configuration of option (may be IConfiguration or
- * IResourceConfiguration)
- * @param holder
- * contains the holder of the option
- * @param option
- * the option that is handled
- * @param extraArgument
- * extra argument for handler
- *
- * The additional options besides configuration are supplied to
- * provide enough information for querying the default value from
- * a potential data storage back-end.
- *
- * @return True if the options value is its default value and False
- * otherwise. This enables that default event handling can take
- * place.
- */
- boolean isDefaultValue(IBuildObject configuration, IHoldsOptions holder,
- IOption option, String extraArgument);
-
- /**
- * Checks whether an enumeration value of an option is currently a valid
- * choice. The use-case for this method is the case, where the set of valid
- * enumerations in the plugin.xml file changes. The UI will remove entries
- * from selection lists if the value returns false.
- *
- * @param configuration
- * build configuration of option (may be IConfiguration or
- * IResourceConfiguration)
- * @param holder
- * contains the holder of the option
- * @param option
- * the option that is handled
- * @param extraArgument
- * extra argument for handler
- * @param enumValue
- * enumeration value that is to be checked
- *
- * The additional options besides configuration are supplied to
- * provide enough information for querying information from a a
- * potential data storage back-end.
- *
- * @return True if the enumeration value is valid and False otherwise.
- */
- boolean isEnumValueAppropriate(IBuildObject configuration,
- IHoldsOptions holder, IOption option, String extraArgument,
- String enumValue);
+/**
+ * Checks whether an enumeration value of an option is currently a
+ * valid choice. The use-case for this method is the case, where
+ * the set of valid enumerations in the plugin.xml file changes.
+ * The UI will remove entries from selection lists if the value
+ * returns false.
+ *
+ * @param configuration build configuration of option
+ * (may be IConfiguration or IResourceConfiguration)
+ * @param holder contains the holder of the option
+ * @param option the option that is handled
+ * @param extraArgument extra argument for handler
+ * @param enumValue enumeration value that is to be checked
+ *
+ * The additional options besides configuration are supplied to
+ * provide enough information for querying information from a
+ * a potential data storage back-end.
+ *
+ * @return True if the enumeration value is valid and False
+ * otherwise.
+ */
+boolean isEnumValueAppropriate(IBuildObject configuration,
+ IHoldsOptions holder,
+ IOption option,
+ String extraArgument,
+ String enumValue);
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java Wed Aug 05 17:35:39 2009 -0500
@@ -4691,11 +4691,8 @@
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION,
builder);
- if (resolved!=null) {
- resolved = resolved.trim();
- if(resolved.length() > 0)
- buildTargetName = resolved;
- }
+ if((resolved = resolved.trim()).length() > 0)
+ buildTargetName = resolved;
} catch (BuildMacroException e){
}
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.master/feature.xml
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.master/feature.xml Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.master/feature.xml Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.platform-feature/feature.xml
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.platform-feature/feature.xml Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.platform-feature/feature.xml Wed Aug 05 17:35:39 2009 -0500
@@ -2,7 +2,7 @@
diff -r fcb77f9783d2 -r 49c226a8748e cdt/cdt_6_0_x/org.eclipse.cdt.releng/build.xml
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.releng/build.xml Tue Aug 04 14:00:13 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.releng/build.xml Wed Aug 05 17:35:39 2009 -0500
@@ -17,7 +17,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
@@ -300,9 +300,8 @@
]]>
-
-