Skip to content

Commit 18b8cc4

Browse files
committed
Merge branch 'master' of github.com:vogella/vogella
2 parents 24c0ce8 + a548c0a commit 18b8cc4

11 files changed

Lines changed: 254 additions & 3 deletions

File tree

de.vogella.android.todos/src/de/vogella/android/todos/TodosOverview.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void onCreateContextMenu(ContextMenu menu, View v,
127127
@Override
128128
protected void onDestroy() {
129129
super.onDestroy();
130-
if (dbHelper == null) {
130+
if (dbHelper != null) {
131131
dbHelper.close();
132132
}
133133
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>de.vogella.jdt.addclasspath</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#Tue Aug 16 23:52:54 CEST 2011
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.compliance=1.6
6+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8+
org.eclipse.jdt.core.compiler.source=1.6
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Addclasspath
4+
Bundle-SymbolicName: de.vogella.jdt.addclasspath; singleton:=true
5+
Bundle-Version: 1.0.0.qualifier
6+
Bundle-Activator: de.vogella.jdt.addclasspath.Activator
7+
Require-Bundle: org.eclipse.ui,
8+
org.eclipse.core.runtime,
9+
org.eclipse.jdt.core;bundle-version="3.7.0",
10+
org.eclipse.core.resources;bundle-version="3.7.100"
11+
Bundle-ActivationPolicy: lazy
12+
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = plugin.xml,\
4+
META-INF/,\
5+
.,\
6+
icons/
983 Bytes
Loading
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
5+
<extension
6+
point="org.eclipse.ui.commands">
7+
<category
8+
name="Sample Category"
9+
id="de.vogella.jdt.addclasspath.commands.category">
10+
</category>
11+
<command
12+
name="Sample Command"
13+
categoryId="de.vogella.jdt.addclasspath.commands.category"
14+
id="de.vogella.jdt.addclasspath.commands.sampleCommand">
15+
</command>
16+
</extension>
17+
<extension
18+
point="org.eclipse.ui.handlers">
19+
<handler
20+
commandId="de.vogella.jdt.addclasspath.commands.sampleCommand"
21+
class="de.vogella.jdt.addclasspath.handlers.SampleHandler">
22+
</handler>
23+
</extension>
24+
<extension
25+
point="org.eclipse.ui.bindings">
26+
<key
27+
commandId="de.vogella.jdt.addclasspath.commands.sampleCommand"
28+
contextId="org.eclipse.ui.contexts.window"
29+
sequence="M1+6"
30+
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
31+
</key>
32+
</extension>
33+
<extension
34+
point="org.eclipse.ui.menus">
35+
<menuContribution
36+
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
37+
<menu
38+
label="Sample Menu"
39+
mnemonic="M"
40+
id="de.vogella.jdt.addclasspath.menus.sampleMenu">
41+
<command
42+
commandId="de.vogella.jdt.addclasspath.commands.sampleCommand"
43+
mnemonic="S"
44+
id="de.vogella.jdt.addclasspath.menus.sampleCommand">
45+
</command>
46+
</menu>
47+
</menuContribution>
48+
<menuContribution
49+
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
50+
<toolbar
51+
id="de.vogella.jdt.addclasspath.toolbars.sampleToolbar">
52+
<command
53+
commandId="de.vogella.jdt.addclasspath.commands.sampleCommand"
54+
icon="icons/sample.gif"
55+
tooltip="Say hello world"
56+
id="de.vogella.jdt.addclasspath.toolbars.sampleCommand">
57+
</command>
58+
</toolbar>
59+
</menuContribution>
60+
</extension>
61+
62+
</plugin>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package de.vogella.jdt.addclasspath;
2+
3+
import org.eclipse.jface.resource.ImageDescriptor;
4+
import org.eclipse.ui.plugin.AbstractUIPlugin;
5+
import org.osgi.framework.BundleContext;
6+
7+
/**
8+
* The activator class controls the plug-in life cycle
9+
*/
10+
public class Activator extends AbstractUIPlugin {
11+
12+
// The plug-in ID
13+
public static final String PLUGIN_ID = "de.vogella.jdt.addclasspath"; //$NON-NLS-1$
14+
15+
// The shared instance
16+
private static Activator plugin;
17+
18+
/**
19+
* The constructor
20+
*/
21+
public Activator() {
22+
}
23+
24+
/*
25+
* (non-Javadoc)
26+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
27+
*/
28+
public void start(BundleContext context) throws Exception {
29+
super.start(context);
30+
plugin = this;
31+
}
32+
33+
/*
34+
* (non-Javadoc)
35+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
36+
*/
37+
public void stop(BundleContext context) throws Exception {
38+
plugin = null;
39+
super.stop(context);
40+
}
41+
42+
/**
43+
* Returns the shared instance
44+
*
45+
* @return the shared instance
46+
*/
47+
public static Activator getDefault() {
48+
return plugin;
49+
}
50+
51+
/**
52+
* Returns an image descriptor for the image file at the given
53+
* plug-in relative path
54+
*
55+
* @param path the path
56+
* @return the image descriptor
57+
*/
58+
public static ImageDescriptor getImageDescriptor(String path) {
59+
return imageDescriptorFromPlugin(PLUGIN_ID, path);
60+
}
61+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package de.vogella.jdt.addclasspath.handlers;
2+
3+
import org.eclipse.core.commands.AbstractHandler;
4+
import org.eclipse.core.commands.ExecutionEvent;
5+
import org.eclipse.core.commands.ExecutionException;
6+
import org.eclipse.core.resources.IProject;
7+
import org.eclipse.core.resources.IWorkspace;
8+
import org.eclipse.core.resources.IWorkspaceRoot;
9+
import org.eclipse.core.resources.ResourcesPlugin;
10+
import org.eclipse.core.runtime.CoreException;
11+
import org.eclipse.core.runtime.Path;
12+
import org.eclipse.jdt.core.IClasspathEntry;
13+
import org.eclipse.jdt.core.IJavaProject;
14+
import org.eclipse.jdt.core.JavaCore;
15+
16+
public class SampleHandler extends AbstractHandler {
17+
18+
public Object execute(ExecutionEvent event) throws ExecutionException {
19+
IWorkspace workspace = ResourcesPlugin.getWorkspace();
20+
IWorkspaceRoot root = workspace.getRoot();
21+
// Get all projects in the workspace
22+
IProject[] projects = root.getProjects();
23+
// Loop over all projects
24+
for (IProject project : projects) {
25+
try {
26+
// Only work on open projects with the Java nature
27+
if (project.isOpen()
28+
&& project
29+
.isNatureEnabled("org.eclipse.jdt.core.javanature")) {
30+
31+
IJavaProject javaProject = JavaCore.create(project);
32+
IClasspathEntry[] entries = javaProject.getRawClasspath();
33+
IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
34+
35+
System.arraycopy(entries, 0, newEntries, 0, entries.length);
36+
37+
// add a new entry using the path to the container
38+
Path junitPath = new Path(
39+
"org.eclipse.jdt.junit.JUNIT_CONTAINER/4");
40+
IClasspathEntry junitEntry = JavaCore
41+
.newContainerEntry(junitPath);
42+
newEntries[entries.length] = JavaCore
43+
.newContainerEntry(junitEntry.getPath());
44+
javaProject.setRawClasspath(newEntries, null);
45+
}
46+
} catch (CoreException e) {
47+
e.printStackTrace();
48+
}
49+
}
50+
return null;
51+
}
52+
}

0 commit comments

Comments
 (0)