Skip to content

Commit d9cbb9a

Browse files
committed
updates
1 parent a6d9280 commit d9cbb9a

871 files changed

Lines changed: 65430 additions & 118 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical" >
6+
7+
<ImageView
8+
android:id="@+id/imageView1"
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:src="@drawable/ic_launcher" />
12+
13+
</LinearLayout>

android.codecamp/res/layout/main.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44
android:layout_height="fill_parent"
55
android:orientation="vertical" >
66

7-
<ListView
8-
android:id="@+id/listView1"
7+
<Button
8+
android:id="@+id/button1"
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:text="Button" />
12+
13+
<EditText
14+
android:id="@+id/editText1"
915
android:layout_width="match_parent"
10-
android:layout_height="wrap_content" >
11-
</ListView>
16+
android:layout_height="wrap_content"
17+
android:ems="10"
18+
android:inputType="textNoSuggestions" >
19+
20+
<requestFocus />
21+
</EditText>
1222

1323
</LinearLayout>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package android.codecamp.test;
2+
3+
import android.content.Context;
4+
import android.graphics.Canvas;
5+
import android.graphics.Color;
6+
import android.graphics.Paint;
7+
import android.graphics.Path;
8+
import android.view.MotionEvent;
9+
import android.view.View;
10+
11+
public class DrawingView extends View {
12+
13+
private Paint paint;
14+
private Path path;
15+
16+
public DrawingView(Context context) {
17+
super(context);
18+
paint = new Paint();
19+
path = new Path();
20+
paint.setColor(Color.WHITE);
21+
paint.setStyle(Paint.Style.STROKE);
22+
paint.setStrokeJoin(Paint.Join.ROUND);
23+
paint.setStrokeWidth(10f);
24+
25+
}
26+
27+
@Override
28+
protected void onDraw(Canvas canvas) {
29+
canvas.drawPath(path, paint);
30+
if (isInEditMode()) {
31+
canvas.drawRGB(255, 0, 0);
32+
}
33+
}
34+
35+
@Override
36+
public boolean onTouchEvent(MotionEvent event) {
37+
float x = event.getX();
38+
float y = event.getY();
39+
40+
switch (event.getAction()) {
41+
case MotionEvent.ACTION_DOWN:
42+
path.moveTo(x, y);
43+
break;
44+
45+
case MotionEvent.ACTION_MOVE:
46+
path.lineTo(x, y);
47+
invalidate();
48+
break;
49+
default:
50+
break;
51+
}
52+
return true;
53+
}
54+
}
Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,13 @@
11
package android.codecamp.test;
22

3-
import android.app.ListActivity;
3+
import android.app.Activity;
44
import android.os.Bundle;
5-
import android.view.Menu;
6-
import android.view.MenuItem;
7-
import android.widget.ArrayAdapter;
85

9-
public class MyActivity extends ListActivity {
6+
public class MyActivity extends Activity {
107
/** Called when the activity is first created. */
118
@Override
129
public void onCreate(Bundle savedInstanceState) {
1310
super.onCreate(savedInstanceState);
14-
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
15-
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
16-
"Linux", "OS/2" };
17-
ArrayAdapter adapter = new ArrayAdapter(this,
18-
android.R.layout.simple_list_item_1, values);
19-
setListAdapter(adapter);
20-
adapter.addAll(collection)
11+
setContentView(R.layout.main);
2112
}
22-
23-
@Override
24-
public boolean onCreateOptionsMenu(Menu menu) {
25-
getMenuInflater().inflate(R.menu.mymenu, menu);
26-
return super.onCreateOptionsMenu(menu);
27-
}
28-
29-
@Override
30-
public boolean onOptionsItemSelected(MenuItem item) {
31-
switch (item.getItemId()) {
32-
case R.id.menuitem1:
33-
34-
break;
35-
case R.id.menuitem2:
36-
37-
break;
38-
39-
default:
40-
break;
41-
}
42-
return true;
43-
}
44-
4513
}

de.vogella.plugin.htmlconverter/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<extension
2929
point="org.eclipse.ui.commands">
3030
<command
31-
defaultHandler="de.vogella.plugin.htmlconverter.handler.Convert"
31+
defaultHandler="de.vogella.plugin.htmlconverter.handler.ConvertHandler"
3232
id="de.vogella.plugin.htmlconverter.convert"
3333
name="Convert">
3434
</command>

de.vogella.plugin.htmlconverter/src/de/vogella/plugin/htmlconverter/handler/Convert.java renamed to de.vogella.plugin.htmlconverter/src/de/vogella/plugin/htmlconverter/handler/ConvertHandler.java

Lines changed: 31 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,57 @@
1010
import org.eclipse.core.resources.IResource;
1111
import org.eclipse.core.runtime.CoreException;
1212
import org.eclipse.core.runtime.QualifiedName;
13-
import org.eclipse.jdt.core.Flags;
1413
import org.eclipse.jdt.core.ICompilationUnit;
15-
import org.eclipse.jdt.core.IMethod;
16-
import org.eclipse.jdt.core.IType;
1714
import org.eclipse.jdt.core.JavaModelException;
1815
import org.eclipse.jface.dialogs.MessageDialog;
16+
import org.eclipse.jface.viewers.ISelection;
1917
import org.eclipse.jface.viewers.IStructuredSelection;
2018
import org.eclipse.swt.widgets.DirectoryDialog;
19+
import org.eclipse.swt.widgets.Shell;
2120
import org.eclipse.ui.handlers.HandlerUtil;
2221

23-
public class Convert extends AbstractHandler {
22+
public class ConvertHandler extends AbstractHandler {
2423
private QualifiedName path = new QualifiedName("html", "path");
2524

2625
@Override
2726
public Object execute(ExecutionEvent event) throws ExecutionException {
27+
Shell shell = HandlerUtil.getActiveShell(event);
28+
ISelection sel = HandlerUtil.getActiveMenuSelection(event);
29+
IStructuredSelection selection = (IStructuredSelection) sel;
2830

29-
IStructuredSelection selection = (IStructuredSelection) HandlerUtil
30-
.getActiveMenuSelection(event);
31-
32-
String directory = "";
3331
Object firstElement = selection.getFirstElement();
3432
if (firstElement instanceof ICompilationUnit) {
35-
ICompilationUnit cu = (ICompilationUnit) firstElement;
36-
IResource res = cu.getResource();
37-
boolean newDirectory = true;
38-
directory = getPersistentProperty(res, path);
39-
40-
if (directory != null && directory.length() > 0) {
41-
newDirectory = !(MessageDialog.openQuestion(
42-
HandlerUtil.getActiveShell(event), "Question",
43-
"Use the previous output directory?"));
44-
}
45-
if (newDirectory) {
46-
DirectoryDialog fileDialog = new DirectoryDialog(
47-
HandlerUtil.getActiveShell(event));
48-
directory = fileDialog.open();
49-
50-
}
51-
if (directory != null && directory.length() > 0) {
52-
analyze(cu);
53-
setPersistentProperty(res, path, directory);
54-
write(directory, cu);
55-
}
33+
createOutput(shell, firstElement);
5634

5735
} else {
58-
MessageDialog.openInformation(HandlerUtil.getActiveShell(event),
59-
"Information", "Please select a Java source file");
36+
MessageDialog.openInformation(shell, "Info",
37+
"Please select a Java source file");
6038
}
6139
return null;
6240
}
6341

42+
private void createOutput(Shell shell, Object firstElement) {
43+
String directory;
44+
ICompilationUnit cu = (ICompilationUnit) firstElement;
45+
IResource res = cu.getResource();
46+
boolean newDirectory = true;
47+
directory = getPersistentProperty(res, path);
48+
49+
if (directory != null && directory.length() > 0) {
50+
newDirectory = !(MessageDialog.openQuestion(shell, "Question",
51+
"Use the previous output directory?"));
52+
}
53+
if (newDirectory) {
54+
DirectoryDialog fileDialog = new DirectoryDialog(shell);
55+
directory = fileDialog.open();
56+
57+
}
58+
if (directory != null && directory.length() > 0) {
59+
setPersistentProperty(res, path, directory);
60+
write(directory, cu);
61+
}
62+
}
63+
6464
protected String getPersistentProperty(IResource res, QualifiedName qn) {
6565
try {
6666
return res.getPersistentProperty(qn);
@@ -69,38 +69,6 @@ protected String getPersistentProperty(IResource res, QualifiedName qn) {
6969
}
7070
}
7171

72-
// TODO: Include this in the HTML output
73-
74-
private void analyze(ICompilationUnit cu) {
75-
// Cool JDT allows you to analyze the code easily
76-
// I don't see really a use case here but I just wanted to do this here
77-
// as I consider this as cool and
78-
// what to have a place where I can store the data
79-
try {
80-
81-
IType type = null;
82-
IType[] allTypes;
83-
allTypes = cu.getAllTypes();
84-
/**
85-
* Search the public class
86-
*/
87-
for (int t = 0; t < allTypes.length; t++) {
88-
if (Flags.isPublic((allTypes[t].getFlags()))) {
89-
type = allTypes[t];
90-
break;
91-
}
92-
}
93-
if (type != null) {
94-
String classname = type.getFullyQualifiedName();
95-
IMethod[] methods = type.getMethods();
96-
}
97-
98-
} catch (JavaModelException e) {
99-
e.printStackTrace();
100-
}
101-
102-
}
103-
10472
protected void setPersistentProperty(IResource res, QualifiedName qn,
10573
String value) {
10674
try {
@@ -116,11 +84,7 @@ private void write(String dir, ICompilationUnit cu) {
11684
String test = cu.getCorrespondingResource().getName();
11785
// Need
11886
String[] name = test.split("\\.");
119-
System.out.println(test);
120-
System.out.println(name.length);
12187
String htmlFile = dir + "\\" + name[0] + ".html";
122-
123-
System.out.println(htmlFile);
12488
FileWriter output = new FileWriter(htmlFile);
12589
BufferedWriter writer = new BufferedWriter(output);
12690
writer.write("<html>");

de.vogella.plugin.markers/plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<extension
55
point="org.eclipse.ui.commands">
66
<command
7-
defaultHandler="de.vogella.plugin.markers.handler.AddMarker"
8-
id="de.vogella.plugin.markers.AddMarker"
7+
defaultHandler="de.vogella.plugin.markers.handler.AddMarkerHandler"
8+
id="de.vogella.plugin.markers.AddMarkerHandler"
99
name="Add Marker">
1010
</command>
1111
</extension>

de.vogella.plugin.markers/src/de/vogella/plugin/markers/handler/AddMarker.java renamed to de.vogella.plugin.markers/src/de/vogella/plugin/markers/handler/AddMarkerHandler.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.eclipse.jface.viewers.IStructuredSelection;
1010
import org.eclipse.ui.handlers.HandlerUtil;
1111

12-
public class AddMarker extends AbstractHandler {
12+
public class AddMarkerHandler extends AbstractHandler {
1313

1414
@Override
1515
public Object execute(ExecutionEvent event) throws ExecutionException {
@@ -21,16 +21,20 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
2121
Object firstElement = selection.getFirstElement();
2222
if (firstElement instanceof IJavaProject) {
2323
IJavaProject type = (IJavaProject) firstElement;
24-
try {
25-
IResource resource = type.getUnderlyingResource();
26-
IMarker marker = resource.createMarker(IMarker.TASK);
27-
marker.setAttribute(IMarker.MESSAGE, "This a a task");
28-
marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
29-
} catch (Exception e) {
30-
e.printStackTrace();
31-
}
24+
writeMarkers(type);
3225

3326
}
3427
return null;
3528
}
29+
30+
private void writeMarkers(IJavaProject type) {
31+
try {
32+
IResource resource = type.getUnderlyingResource();
33+
IMarker marker = resource.createMarker(IMarker.TASK);
34+
marker.setAttribute(IMarker.MESSAGE, "This a a task");
35+
marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
36+
} catch (Exception e) {
37+
e.printStackTrace();
38+
}
39+
}
3640
}

tesitng/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry kind="output" path="bin/classes"/>
8+
</classpath>

tesitng/.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>tesitng</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

0 commit comments

Comments
 (0)