summaryrefslogtreecommitdiff
path: root/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2011-02-01 12:54:18 -0800
committerMark Spruiell <mes@zeroc.com>2011-02-01 12:54:18 -0800
commit7ca6c19f351273d8101a47f0ac5a1b08333370c4 (patch)
tree2fffa668af451becea65fb5c69d63458b291557a /eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin
parent4975 - Uninitialized _fd on FileUtil.cpp (diff)
downloadice-7ca6c19f351273d8101a47f0ac5a1b08333370c4.tar.bz2
ice-7ca6c19f351273d8101a47f0ac5a1b08333370c4.tar.xz
ice-7ca6c19f351273d8101a47f0ac5a1b08333370c4.zip
merging eclipse plug-in from R3_3_branch
Diffstat (limited to 'eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin')
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/Activator.java4
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaBuilder.java7
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaNature.java2
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/ToggleNatureAction.java2
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Configuration.java189
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Dependencies.java30
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainer.java4
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainerIntializer.java30
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathVariableInitializer.java47
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PluginPreferencePage.java2
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PreferenceInitializer.java8
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/ProjectProperties.java54
-rw-r--r--eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SourceSelectionDialog.java2
13 files changed, 267 insertions, 114 deletions
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/Activator.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/Activator.java
index e3d5e754086..a2078d81997 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/Activator.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/Activator.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -35,6 +35,7 @@ import org.osgi.framework.BundleContext;
import com.zeroc.slice2javaplugin.builder.Slice2JavaBuilder;
import com.zeroc.slice2javaplugin.builder.Slice2JavaNature;
import com.zeroc.slice2javaplugin.internal.IceClasspathContainerIntializer;
+import com.zeroc.slice2javaplugin.internal.IceClasspathVariableInitializer;
import com.zeroc.slice2javaplugin.preferences.PluginPreferencePage;
/**
@@ -106,6 +107,7 @@ public class Activator extends AbstractUIPlugin
List<IJavaProject> projects = getSlice2JavaProjects(javaModel);
String value = (String)event.getNewValue();
IceClasspathContainerIntializer.updateProjects(value, projects);
+ IceClasspathVariableInitializer.update(value);
// Need to trigger a clean build of the projects.
for(final IJavaProject p : projects)
{
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaBuilder.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaBuilder.java
index 7a84a09aa98..dbed4e511e7 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaBuilder.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaBuilder.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -1013,12 +1013,14 @@ public class Slice2JavaBuilder extends IncrementalProjectBuilder
Map<IFile, Entry> output = new HashMap<IFile, Entry>(); // Map of source files to build entry.
private IFolder _generated;
+ private IPath _generatedPath;
// Map of absolute path to project location.
private Map<IPath, IFile> _sources = new HashMap<IPath, IFile>();
Slice2JavaGeneratedParser(IFolder generated, Set<IFile> candidates)
{
_generated = generated;
+ _generatedPath = generated.getProjectRelativePath();
for(IFile f : candidates)
{
_sources.put(f.getLocation(), f);
@@ -1043,7 +1045,8 @@ public class Slice2JavaBuilder extends IncrementalProjectBuilder
private IFile convert(String fname)
{
IPath p = new Path(fname); // fname contains "generated/...".
- return _generated.getFile(p.removeFirstSegments(1));
+ int match = p.matchingFirstSegments(_generatedPath);
+ return _generated.getFile(p.removeFirstSegments(match));
}
public Set<IFile> visitSource(Node source) throws SAXException
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaNature.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaNature.java
index 1140f4aac23..af9710ee4b8 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaNature.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/Slice2JavaNature.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/ToggleNatureAction.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/ToggleNatureAction.java
index 234c51abcb9..1e3a84573f3 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/ToggleNatureAction.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/builder/ToggleNatureAction.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Configuration.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Configuration.java
index f215e386bde..98f0d0e3abf 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Configuration.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Configuration.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -45,6 +45,15 @@ public class Configuration
_store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
+ _androidProject = false;
+ try
+ {
+ _androidProject = project.hasNature("com.android.ide.eclipse.adt.AndroidNature");
+ }
+ catch(CoreException e)
+ {
+ }
+
_store.setDefault(GENERATED_KEY, GENERATED_KEY);
_store.setDefault(DEFINES_KEY, "");
_store.setDefault(TIE_KEY, false);
@@ -55,18 +64,12 @@ public class Configuration
_store.setDefault(CONSOLE_KEY, false);
_store.setDefault(SLICE_SOURCE_DIRS_KEY, "slice");
_store.setDefault(INCLUDES_KEY, "");
- boolean androidProject = false;
- try
- {
- androidProject = project.hasNature("com.android.ide.eclipse.adt.AndroidNature");
- }
- catch(CoreException e)
- {
- }
- if(androidProject)
+ _store.setDefault(ADD_JARS_KEY, !_androidProject);
+ _store.setDefault(UNDERSCORE_KEY, false);
+
+ if(_androidProject)
{
// TODO: At present android does not work with indirect libraries.
- //_store.setDefault(JARS_KEY, "IceAndroid.jar");
_store.setDefault(JARS_KEY, "");
}
else
@@ -78,7 +81,7 @@ public class Configuration
/**
* Turns list of strings into a single ';' delimited string. ';' in the
* string values are escaped with a leading '\'. '\' are turned into '\\'.
- *
+ *
* @param l
* List of strings.
* @return Semicolon delimited string.
@@ -100,7 +103,7 @@ public class Configuration
/**
* Turn a semicolon delimited string into a list of strings. Escaped values
* are preserved (characters prefixed with a '\').
- *
+ *
* @param s
* Semicolon delimited string.
* @return List of strings.
@@ -164,9 +167,22 @@ public class Configuration
rc = true;
}
+ if(rc)
+ {
+ IJavaProject javaProject = JavaCore.create(_project);
+ if(getAddJars())
+ {
+ addLibrary(javaProject);
+ }
+ else
+ {
+ removeLibrary(javaProject);
+ }
+ }
+
return rc;
}
-
+
public void initialize()
throws CoreException
{
@@ -190,34 +206,13 @@ public class Configuration
fixGeneratedCP(null, getGeneratedDir());
IJavaProject javaProject = JavaCore.create(_project);
-
- IClasspathEntry cpEntry = IceClasspathContainerIntializer.getContainerEntry();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
-
- boolean found = false;
- for(int i = 0; i < entries.length; ++i)
+ if(getAddJars())
{
- if(entries[i].equals(cpEntry))
- {
- found = true;
- break;
- }
+ addLibrary(javaProject);
}
-
- if(!found)
+ else
{
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 0, entries.length);
- newEntries[entries.length] = cpEntry;
-
- try
- {
- javaProject.setRawClasspath(newEntries, null);
- }
- catch(JavaModelException e)
- {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), null));
- }
+ removeLibrary(javaProject);
}
}
@@ -225,29 +220,12 @@ public class Configuration
throws CoreException
{
IJavaProject javaProject = JavaCore.create(_project);
+ removeLibrary(javaProject);
+ }
- IClasspathEntry cpEntry = IceClasspathContainerIntializer.getContainerEntry();
- IClasspathEntry[] entries = javaProject.getRawClasspath();
-
- for(int i = 0; i < entries.length; ++i)
- {
- if(entries[i].equals(cpEntry))
- {
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length - 1];
- System.arraycopy(entries, 0, newEntries, 0, i);
- System.arraycopy(entries, i + 1, newEntries, i, entries.length - i - 1);
-
- try
- {
- javaProject.setRawClasspath(newEntries, null);
- }
- catch(JavaModelException e)
- {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), null));
- }
- break;
- }
- }
+ public boolean isAndroidProject()
+ {
+ return _androidProject;
}
public List<String> getSliceSourceDirs()
@@ -345,6 +323,10 @@ public class Configuration
{
cmds.add("--ice");
}
+ if(getUnderscore())
+ {
+ cmds.add("--underscore");
+ }
return cmds;
}
@@ -400,7 +382,17 @@ public class Configuration
{
setValue(INCLUDES_KEY, fromList(includes));
}
-
+
+ public boolean getAddJars()
+ {
+ return _store.getBoolean(ADD_JARS_KEY);
+ }
+
+ public void setAddJars(boolean b)
+ {
+ _store.setValue(ADD_JARS_KEY, b);
+ }
+
public List<String> getJars()
{
return toList(_store.getString(JARS_KEY));
@@ -454,6 +446,16 @@ public class Configuration
_store.setValue(ICE_KEY, ice);
}
+ public boolean getUnderscore()
+ {
+ return _store.getBoolean(UNDERSCORE_KEY);
+ }
+
+ public void setUnderscore(boolean underscore)
+ {
+ _store.setValue(UNDERSCORE_KEY, underscore);
+ }
+
public boolean getConsole()
{
return _store.getBoolean(CONSOLE_KEY);
@@ -713,6 +715,66 @@ public class Configuration
return null;
}
+ private void addLibrary(IJavaProject project)
+ throws CoreException
+ {
+ IClasspathEntry cpEntry = IceClasspathContainerIntializer.getContainerEntry();
+ IClasspathEntry[] entries = project.getRawClasspath();
+
+ boolean found = false;
+ for(int i = 0; i < entries.length; ++i)
+ {
+ if(entries[i].equals(cpEntry))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
+ System.arraycopy(entries, 0, newEntries, 0, entries.length);
+ newEntries[entries.length] = cpEntry;
+
+ try
+ {
+ project.setRawClasspath(newEntries, null);
+ }
+ catch(JavaModelException e)
+ {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), null));
+ }
+ }
+ }
+
+ public void removeLibrary(IJavaProject project)
+ throws CoreException
+ {
+ IClasspathEntry cpEntry = IceClasspathContainerIntializer.getContainerEntry();
+ IClasspathEntry[] entries = project.getRawClasspath();
+
+ for(int i = 0; i < entries.length; ++i)
+ {
+ if(entries[i].equals(cpEntry))
+ {
+ IClasspathEntry[] newEntries = new IClasspathEntry[entries.length - 1];
+ System.arraycopy(entries, 0, newEntries, 0, i);
+ System.arraycopy(entries, i + 1, newEntries, i, entries.length - i - 1);
+
+ try
+ {
+ project.setRawClasspath(newEntries, null);
+ }
+ catch(JavaModelException e)
+ {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.toString(), null));
+ }
+ break;
+ }
+ }
+ }
+
private static final String JARS_KEY = "jars";
private static final String INCLUDES_KEY = "includes";
private static final String SLICE_SOURCE_DIRS_KEY = "sliceSourceDirs";
@@ -724,6 +786,8 @@ public class Configuration
private static final String TIE_KEY = "tie";
private static final String DEFINES_KEY = "defines";
private static final String GENERATED_KEY = "generated";
+ private static final String ADD_JARS_KEY = "addJars";
+ private static final String UNDERSCORE_KEY = "underscore";
// Preferences store for items which should go in SCM. This includes things
// like build flags.
@@ -735,4 +799,5 @@ public class Configuration
private IProject _project;
+ private boolean _androidProject;
}
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Dependencies.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Dependencies.java
index 9f1baeab02d..4204a676d69 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Dependencies.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/Dependencies.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -38,7 +38,6 @@ import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -64,9 +63,8 @@ public class Dependencies
// Build a map of location to project resource.
- for(Iterator<IFile> p = _projectResources.iterator(); p.hasNext();)
+ for(IFile f : _projectResources)
{
- IFile f = p.next();
_locationToResource.put(f.getLocation(), f);
}
}
@@ -74,7 +72,6 @@ public class Dependencies
/**
*
* @param allDependencies The string of all dependencies.
- * @param _projectResources a set of all slice file project resources.
* @throws CoreException
*/
public void updateDependencies(String allDependencies)
@@ -103,10 +100,8 @@ public class Dependencies
"internal error reading dependencies", e));
}
- for(Iterator<Map.Entry<String, List<String>>> p = parser.dependencies.entrySet().iterator(); p.hasNext();)
+ for(Map.Entry<String, List<String>> entry : parser.dependencies.entrySet())
{
- Map.Entry<String, List<String>> entry = p.next();
-
Path sourcePath = new Path(entry.getKey());
assert sourcePath.isAbsolute();
@@ -121,9 +116,9 @@ public class Dependencies
continue;
}
- for(Iterator<String> q = entry.getValue().iterator(); q.hasNext();)
+ for(String s : entry.getValue())
{
- IFile f = getProjectResource(new Path(q.next()));
+ IFile f = getProjectResource(new Path(s));
// Ignore any resources not in the project.
if(f != null)
{
@@ -139,9 +134,9 @@ public class Dependencies
Set<IFile> dependents = new HashSet<IFile>();
sliceSliceDependencies.put(sourceFile, dependents);
- for(Iterator<String> q = entry.getValue().iterator(); q.hasNext();)
+ for(String s : entry.getValue())
{
- IFile f = getProjectResource(new Path(q.next()));
+ IFile f = getProjectResource(new Path(s));
// Ignore any resources not in the project.
if(f != null)
{
@@ -160,10 +155,10 @@ public class Dependencies
}
else
{
- IStatus s = _project.getWorkspace().validatePath(path.toString(), IResource.FILE);
- if(s.getCode() == IStatus.OK)
+ f = _project.getFile(path.toString());
+ if(!f.exists())
{
- f = _project.getFile(path);
+ f = null;
}
}
if(_projectResources.contains(f))
@@ -465,10 +460,9 @@ public class Dependencies
Node value = findNode(child, "value");
List<String> files = processFiles(value);
Set<IFile> f = new HashSet<IFile>();
- Iterator<String> p = files.iterator();
- while(p.hasNext())
+ for(String s : files)
{
- f.add(_project.getFile(new Path(p.next())));
+ f.add(_project.getFile(new Path(s)));
}
map.put(key, f);
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainer.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainer.java
index 61849015655..915234c1304 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainer.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainer.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -37,7 +37,7 @@ public class IceClasspathContainer implements IClasspathContainer
public int getKind()
{
- return IClasspathContainer.K_DEFAULT_SYSTEM;
+ return IClasspathContainer.K_APPLICATION;
}
public IPath getPath()
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainerIntializer.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainerIntializer.java
index a38a5c663cc..7d16cb2983c 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainerIntializer.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathContainerIntializer.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -47,10 +47,10 @@ public class IceClasspathContainerIntializer extends ClasspathContainerInitializ
return JavaCore.newContainerEntry(new Path(CONTAINER_ID));
}
- public static void reinitialize(IProject _project, Configuration c)
+ public static void reinitialize(IProject project, Configuration c)
throws CoreException
{
- IJavaProject javaProject = JavaCore.create(_project);
+ IJavaProject javaProject = JavaCore.create(project);
IPath containerPath = new Path(CONTAINER_ID);
configure(c, javaProject, containerPath);
@@ -59,18 +59,21 @@ public class IceClasspathContainerIntializer extends ClasspathContainerInitializ
private static void configure(Configuration c, IJavaProject javaProject, IPath containerPath)
throws JavaModelException
{
- Path dir = new Path(c.getJarDir());
- List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- for(String jar : c.getJars())
+ if(c.getAddJars())
{
- IPath path = dir.append(new Path(jar));
- IClasspathEntry classpathEntry = JavaCore.newLibraryEntry(path, null, null, new IAccessRule[0], new IClasspathAttribute[0], false);
- entries.add(classpathEntry);
+ Path dir = new Path(c.getJarDir());
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ for(String jar : c.getJars())
+ {
+ IPath path = dir.append(new Path(jar));
+ IClasspathEntry classpathEntry = JavaCore.newLibraryEntry(path, null, null, new IAccessRule[0], new IClasspathAttribute[0], false);
+ entries.add(classpathEntry);
+ }
+
+ IClasspathContainer container = new IceClasspathContainer(entries.toArray(new IClasspathEntry[0]), containerPath);
+ JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { javaProject },
+ new IClasspathContainer[] { container }, new NullProgressMonitor());
}
-
- IClasspathContainer container = new IceClasspathContainer(entries.toArray(new IClasspathEntry[0]), containerPath);
- JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { javaProject },
- new IClasspathContainer[] { container }, new NullProgressMonitor());
}
public static void updateProjects(String value, List<IJavaProject> projects)
@@ -85,7 +88,6 @@ public class IceClasspathContainerIntializer extends ClasspathContainerInitializ
}
catch(JavaModelException e)
{
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathVariableInitializer.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathVariableInitializer.java
new file mode 100644
index 00000000000..06af5b796a9
--- /dev/null
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/internal/IceClasspathVariableInitializer.java
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+//
+// This plug-in is provided to you under the terms and conditions
+// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
+// the EPL is available at http://www.eclipse.org/legal/epl-v10.html.
+//
+// **********************************************************************
+
+package com.zeroc.slice2javaplugin.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ClasspathVariableInitializer;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import com.zeroc.slice2javaplugin.Activator;
+import com.zeroc.slice2javaplugin.preferences.PluginPreferencePage;
+
+public class IceClasspathVariableInitializer extends ClasspathVariableInitializer
+{
+ private final static String VARIABLE_NAME = "ICE_HOME";
+
+ @Override
+ public void initialize(String variable)
+ {
+ if(variable.equals(VARIABLE_NAME))
+ {
+ update(Activator.getDefault().getPreferenceStore().getString(PluginPreferencePage.SDK_PATH));
+ }
+ }
+
+ public static void update(String value)
+ {
+ IPath path = new Path(value);
+ try
+ {
+ JavaCore.setClasspathVariable(VARIABLE_NAME, path, null);
+ }
+ catch(JavaModelException e)
+ {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PluginPreferencePage.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PluginPreferencePage.java
index 06fcce8be0f..e478f3d037d 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PluginPreferencePage.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PluginPreferencePage.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PreferenceInitializer.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PreferenceInitializer.java
index d667846a4ee..e87c71181f8 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PreferenceInitializer.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/preferences/PreferenceInitializer.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -31,10 +31,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer
}
else if(os.startsWith("Windows"))
{
- File f = new File("C:\\Ice-3.3.0");
+ File f = new File("C:\\Ice-3.4.1");
if(!f.exists())
{
- File f2 = new File("C:\\Ice-3.3.0-VC90");
+ File f2 = new File("C:\\Ice-3.4.1-VC90");
if(f2.exists())
{
return f2.toString();
@@ -42,7 +42,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer
}
return f.toString();
}
- return "/opt/Ice-3.3.0";
+ return "/opt/Ice-3.4.1";
}
/*
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/ProjectProperties.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/ProjectProperties.java
index ac008445522..7ba7f556522 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/ProjectProperties.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/ProjectProperties.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of
@@ -78,12 +78,14 @@ public class ProjectProperties extends PropertyPage
_config.setGeneratedDir(_generatedDir.getText());
_config.setSliceSourceDirs(Arrays.asList(_sourceDirectories.getItems()));
_config.setIncludes(Arrays.asList(_includes.getItems()));
+ _config.setAddJars(_addJars.getSelection());
_config.setJars(Arrays.asList(_jars.getItems()));
_config.setDefines(Configuration.toList(_defines.getText()));
_config.setMeta(Configuration.toList(_meta.getText()));
_config.setStream(_stream.getSelection());
_config.setTie(_tie.getSelection());
_config.setIce(_ice.getSelection());
+ _config.setUnderscore(_underscore.getSelection());
_config.setIceInclude(_iceInclude.getSelection());
_config.setConsole(_console.getSelection());
@@ -176,14 +178,23 @@ public class ProjectProperties extends PropertyPage
{
_jars.add(iter.next());
}
+ _addJars.setSelection(_config.getAddJars());
+ enableControl(_jarsGroup, _config.getAddJars());
_defines.setText(Configuration.fromList(_config.getDefines()));
_meta.setText(Configuration.fromList(_config.getMeta()));
_stream.setSelection(_config.getStream());
_tie.setSelection(_config.getTie());
_ice.setSelection(_config.getIce());
+ _underscore.setSelection(_config.getUnderscore());
_iceInclude.setSelection(_config.getIceInclude());
_console.setSelection(_config.getConsole());
+ //
+ // Android projects don't support the use of classpath libraries.
+ //
+ _jars.setEnabled(!_config.isAndroidProject());
+ _addJars.setEnabled(!_config.isAndroidProject());
+
checkValid();
}
@@ -209,18 +220,41 @@ public class ProjectProperties extends PropertyPage
gridLayout.numColumns = 1;
composite.setLayout(gridLayout);
- Group includesGroup = new Group(composite, SWT.NONE);
- includesGroup.setText("Jar Files to Reference");
+ _addJars = new Button(composite, SWT.CHECK);
+ _addJars.setText("Add JAR file references to project");
+
+ _jarsGroup = new Group(composite, SWT.NONE);
+ _jarsGroup.setText("JAR Files to Reference");
gridLayout = new GridLayout();
gridLayout.numColumns = 1;
- includesGroup.setLayout(gridLayout);
- includesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+ _jarsGroup.setLayout(gridLayout);
+ _jarsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
- createLinkList(includesGroup);
+ createLinkList(_jarsGroup);
+
+ _addJars.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ enableControl(_jarsGroup, _addJars.getSelection());
+ }
+ });
return composite;
}
+ private static void enableControl(Control c, boolean enabled)
+ {
+ c.setEnabled(enabled);
+ if(c instanceof Composite)
+ {
+ for(Control child : ((Composite)c).getChildren())
+ {
+ enableControl(child, enabled);
+ }
+ }
+ }
+
private Control createSource(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
@@ -671,7 +705,7 @@ public class ProjectProperties extends PropertyPage
Group optionsGroup = new Group(composite, SWT.NONE);
gridLayout = new GridLayout();
- gridLayout.numColumns = 6;
+ gridLayout.numColumns = 5;
optionsGroup.setText("Options");
optionsGroup.setLayout(gridLayout);
optionsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -686,6 +720,9 @@ public class ProjectProperties extends PropertyPage
_iceInclude.setText("Include Ice Slice Files");
_console = new Button(optionsGroup, SWT.CHECK);
_console.setText("Enable console");
+ _underscore = new Button(optionsGroup, SWT.CHECK);
+ _underscore.setText("Enable underscore (Ice 3.4.1 only)");
+ _underscore.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 3, 1));
return composite;
}
@@ -713,10 +750,13 @@ public class ProjectProperties extends PropertyPage
private Text _generatedDir;
private List _sourceDirectories;
private List _includes;
+ private Button _addJars;
private List _jars;
+ private Group _jarsGroup;
private Text _defines;
private Button _stream;
private Button _tie;
private Button _ice;
+ private Button _underscore;
private Text _meta;
}
diff --git a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SourceSelectionDialog.java b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SourceSelectionDialog.java
index 4b033c68579..1d6cf616000 100644
--- a/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SourceSelectionDialog.java
+++ b/eclipse/Slice2javaPlugin/src/com/zeroc/slice2javaplugin/properties/SourceSelectionDialog.java
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This plug-in is provided to you under the terms and conditions
// of the Eclipse Public License Version 1.0 ("EPL"). A copy of