You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2009/09/14 23:47:45 UTC
svn commit: r814877 [1/3] - in /ant/ivy/ivyde/trunk: ./
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontaine...
Author: hibou
Date: Mon Sep 14 21:47:44 2009
New Revision: 814877
URL: http://svn.apache.org/viewvc?rev=814877&view=rev
Log:
IVYDE-178:
- change the way IvyDE store its configuration : use extra attributes, so it does fix the raised issue.
- some refactoring : split very big java classes into sevral ones, like the IvyClasspathContainerConfiguration
Added:
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerState.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobListener.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvySettingsSetup.java (with props)
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RetrieveSetup.java (with props)
Modified:
ant/ivy/ivyde/trunk/CHANGES.txt
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyFileResourceListener.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/AcceptedSuffixesTypesComposite.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/NewIvyDEContainerWizard.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsEditor.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/CleanCacheMenuAction.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/ClasspathPreferencePage.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/RetrievePreferencePage.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/SettingsPreferencePage.java
ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Modified: ant/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/CHANGES.txt?rev=814877&r1=814876&r2=814877&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/CHANGES.txt Mon Sep 14 21:47:44 2009
@@ -12,6 +12,7 @@
- FIX: Workspace Resolver Prevents Source Download (IVYDE-188) (thanks to Phillip Webb)
- FIX: Resolve in Workspace fails to find projects under certain conditions (IVYDE-186) (thanks to Adam Karl)
- FIX: The gui wizard crash when adding a IvyDE Managed Dependencies library to a .launch file's classpath (IVYDE-200)
+- FIX: Ivy Library removed from the list of Java EE Module Dependencies after changing its properties (IVYDE-178)
version 2.0.0 final
==========================
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyFileResourceListener.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyFileResourceListener.java?rev=814877&r1=814876&r2=814877&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyFileResourceListener.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/ivyfile/IvyFileResourceListener.java Mon Sep 14 21:47:44 2009
@@ -57,23 +57,24 @@
}
private static void resourceChanged(IResource resource) {
- if (resource instanceof IFile
- && IvyPlugin.getPreferenceStoreHelper().getAutoResolveOnChange()) {
- IFile resourceFile = (IFile) resource;
- IJavaProject javaProject = JavaCore.create(resource.getProject());
- if (javaProject != null) {
- List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
- .getIvyClasspathContainers(javaProject);
- Iterator containerIter = containers.iterator();
- while (containerIter.hasNext()) {
- IvyClasspathContainer container = (IvyClasspathContainer) containerIter
- .next();
- File containerIvyFile = container.getConf().getIvyFile();
- if (containerIvyFile.equals(resourceFile.getLocation().toFile())) {
- container.launchResolve(false, false, null);
- return;
- }
- }
+ if (!(resource instanceof IFile)
+ || !IvyPlugin.getPreferenceStoreHelper().getAutoResolveOnChange()) {
+ return;
+ }
+ IFile resourceFile = (IFile) resource;
+ IJavaProject javaProject = JavaCore.create(resource.getProject());
+ if (javaProject == null) {
+ return;
+ }
+ List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
+ .getIvyClasspathContainers(javaProject);
+ Iterator containerIter = containers.iterator();
+ while (containerIter.hasNext()) {
+ IvyClasspathContainer container = (IvyClasspathContainer) containerIter.next();
+ File containerIvyFile = container.getState().getIvyFile();
+ if (containerIvyFile.equals(resourceFile.getLocation().toFile())) {
+ container.launchResolve(false, false, null);
+ return;
}
}
}
Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java?rev=814877&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java Mon Sep 14 21:47:44 2009
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * This class seems to be a hack, but it seems to work a lot better with non-null project. So an
+ * IvyDE container will always be attached to a project. But some will be fake, the ones for the
+ * launch configurations.
+ *
+ * see also:
+ * org.eclipse.jdt.internal.ui.preferencesUserLibraryPreferencePage#createPlaceholderProject()
+ */
+public class FakeProjectManager {
+
+ public static boolean isFake(IJavaProject project) {
+ // a fake project doesn't have real path
+ return project.getProject().getLocation() == null;
+ }
+
+ public static IJavaProject createPlaceholderProject() {
+ String name = "####ivyde-launch"; //$NON-NLS-1$
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ while (true) {
+ IProject project = root.getProject(name);
+ if (!project.exists()) {
+ return JavaCore.create(project);
+ }
+ name += '1';
+ }
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/FakeProjectManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java?rev=814877&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java Mon Sep 14 21:47:44 2009
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.cpcontainer;
+
+import java.util.List;
+
+public class ContainerMappingSetup {
+
+ private List/* <String> */acceptedTypes;
+
+ private List/* <String> */sourceTypes;
+
+ private List/* <String> */javadocTypes;
+
+ private List/* <String> */sourceSuffixes;
+
+ private List/* <String> */javadocSuffixes;
+
+ /**
+ * Default constructor
+ */
+ public ContainerMappingSetup() {
+ // default constructor
+ }
+
+ public void set(ContainerMappingSetup setup) {
+ this.acceptedTypes = setup.acceptedTypes;
+ this.sourceTypes = setup.sourceTypes;
+ this.javadocTypes = setup.javadocTypes;
+ this.sourceSuffixes = setup.sourceSuffixes;
+ this.javadocSuffixes = setup.javadocSuffixes;
+ }
+
+ public List getAcceptedTypes() {
+ return acceptedTypes;
+ }
+
+ public void setAcceptedTypes(List acceptedTypes) {
+ this.acceptedTypes = acceptedTypes;
+ }
+
+ public List getSourceTypes() {
+ return sourceTypes;
+ }
+
+ public void setSourceTypes(List sourceTypes) {
+ this.sourceTypes = sourceTypes;
+ }
+
+ public List getJavadocTypes() {
+ return javadocTypes;
+ }
+
+ public void setJavadocTypes(List javadocTypes) {
+ this.javadocTypes = javadocTypes;
+ }
+
+ public List getSourceSuffixes() {
+ return sourceSuffixes;
+ }
+
+ public void setSourceSuffixes(List sourceSuffixes) {
+ this.sourceSuffixes = sourceSuffixes;
+ }
+
+ public List getJavadocSuffixes() {
+ return javadocSuffixes;
+ }
+
+ public void setJavadocSuffixes(List javadocSuffixes) {
+ this.javadocSuffixes = javadocSuffixes;
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ContainerMappingSetup.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?rev=814877&r1=814876&r2=814877&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java Mon Sep 14 21:47:44 2009
@@ -17,7 +17,6 @@
*/
package org.apache.ivyde.eclipse.cpcontainer;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
@@ -34,6 +33,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IElementChangedListener;
@@ -55,7 +55,8 @@
*/
public class IvyClasspathContainer implements IClasspathContainer {
- public static final String CONTAINER_ID = "org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER";
+ public static final String CONTAINER_ID =
+ "org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER";
private IClasspathEntry[] classpathEntries;
@@ -65,6 +66,8 @@
private IvyClasspathContainerConfiguration conf;
+ private final IvyClasspathContainerState state;
+
private String jdtVersion;
/**
@@ -83,13 +86,12 @@
* the configuration that will be resolved
* @param classpathEntries
* the entries to start with
- * @throws IOException
- * @throws MalformedURLException
*/
public IvyClasspathContainer(IJavaProject javaProject, IPath path,
- IClasspathEntry[] classpathEntries) throws IOException {
+ IClasspathEntry[] classpathEntries, IClasspathAttribute[] attributes) {
this.path = path;
- conf = new IvyClasspathContainerConfiguration(javaProject, path, false);
+ conf = new IvyClasspathContainerConfiguration(javaProject, path, false, attributes);
+ state = new IvyClasspathContainerState(conf);
this.classpathEntries = classpathEntries;
}
@@ -97,14 +99,24 @@
path = cp.path;
conf = cp.conf;
classpathEntries = cp.classpathEntries;
+ state = cp.state;
}
public IvyClasspathContainerConfiguration getConf() {
return conf;
}
+ public void setConf(IvyClasspathContainerConfiguration conf) {
+ this.conf = conf;
+ state.setConf(conf);
+ }
+
+ public IvyClasspathContainerState getState() {
+ return state;
+ }
+
public String getDescription() {
- return conf.ivyXmlPath + " " + conf.confs;
+ return conf.getIvyXmlPath() + " " + conf.getConfs();
}
public int getKind() {
@@ -193,12 +205,12 @@
void notifyUpdateClasspathEntries() {
try {
- JavaCore.setClasspathContainer(path, new IJavaProject[] {conf.javaProject},
+ JavaCore.setClasspathContainer(path, new IJavaProject[] {conf.getJavaProject()},
new IClasspathContainer[] {new IvyClasspathContainer(IvyClasspathContainer.this)},
null);
// the following code was imported from:
- //http://svn.codehaus.org/m2eclipse/trunk/org.maven.ide.eclipse/src/org/maven/ide/eclipse
+ // http://svn.codehaus.org/m2eclipse/trunk/org.maven.ide.eclipse/src/org/maven/ide/eclipse
// /embedder/BuildPathManager.java
// revision: 370; function setClasspathContainer; line 215
@@ -212,12 +224,12 @@
// reconcile PackageExplorer with actual classpath
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=154071
if (getJDTVersion().startsWith("3.3")) {
- DeltaProcessingState state = JavaModelManager.getJavaModelManager().deltaState;
- synchronized (state) {
- IElementChangedListener[] listeners = state.elementChangedListeners;
+ DeltaProcessingState s = JavaModelManager.getJavaModelManager().deltaState;
+ synchronized (s) {
+ IElementChangedListener[] listeners = s.elementChangedListeners;
for (int i = 0; i < listeners.length; i++) {
if (listeners[i] instanceof PackageExplorerContentProvider) {
- JavaElementDelta delta = new JavaElementDelta(conf.javaProject);
+ JavaElementDelta delta = new JavaElementDelta(conf.getJavaProject());
delta.changed(IJavaElementDelta.F_CLASSPATH_CHANGED);
listeners[i].elementChanged(new ElementChangedEvent(delta,
ElementChangedEvent.POST_CHANGE));
@@ -245,8 +257,8 @@
}
public URL getReportUrl() throws IvyDEException {
- Ivy ivy = conf.getIvy();
- ModuleDescriptor md = conf.getModuleDescriptor();
+ Ivy ivy = state.getIvy();
+ ModuleDescriptor md = state.getModuleDescriptor();
String resolveId = ResolveOptions.getDefaultResolveId(md);
try {
return ivy.getResolutionCacheManager().getConfigurationResolveReportInCache(resolveId,
@@ -262,7 +274,7 @@
}
public void reloadSettings() {
- conf.ivySettingsLastModified = -1;
+ state.setIvySettingsLastModified(-1);
launchResolve(false, true, null);
}
Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java?rev=814877&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java Mon Sep 14 21:47:44 2009
@@ -0,0 +1,377 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.cpcontainer;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.ivyde.eclipse.FakeProjectManager;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * This class maps the IvyDE classpath container configuration into Eclipse objects representing
+ * containers (IPath and IClasspathAttribute).
+ */
+public final class IvyClasspathContainerConfAdapter {
+
+ private static final String UTF8_ERROR = "The UTF-8 encoding support is required"
+ + " is decode the path of the container.";
+
+ private static final String PROJECT_SCHEME_PREFIX = "project://";
+
+ private IvyClasspathContainerConfAdapter() {
+ // utility class
+ }
+
+ public static void load(IvyClasspathContainerConfiguration conf, IPath path,
+ IClasspathAttribute[] attributes) {
+ if (path.segmentCount() > 2) {
+ loadV0(conf, path);
+ } else {
+ loadV1(conf, path);
+ }
+ loadAttributes(conf, attributes);
+ }
+
+ /**
+ * Load the pre-IVYDE-70 configuration
+ *
+ * @param path
+ * the path of the container
+ */
+ private static void loadV0(IvyClasspathContainerConfiguration conf, IPath path) {
+ // load some configuration that can be loaded
+ conf.setIvyXmlPath(path.removeFirstSegments(1).removeLastSegments(1).toString());
+ List confs = IvyClasspathUtil.split(path.lastSegment());
+ if (confs.isEmpty()) {
+ confs = Collections.singletonList("*");
+ }
+ conf.setConfs(confs);
+ // the last part of the configuration coming from the preferences cannot be loaded due to
+ // the bug described in IVYDE-70, so the configuration is let as the default one
+ }
+
+ /**
+ * Load the post-IVYDE-70 configuration
+ *
+ * @param path
+ * the path of the container
+ */
+ private static void loadV1(IvyClasspathContainerConfiguration conf, IPath path) {
+ ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup();
+ RetrieveSetup retrieveSetup = conf.getRetrieveSetup();
+ IvySettingsSetup settingsSetup = conf.getIvySettingsSetup();
+
+ String url = path.segment(1).substring(1);
+ String[] parameters = url.split("&");
+ conf.setAdvancedProjectSpecific(false);
+ conf.setRetrieveProjectSpecific(false);
+ conf.setSettingsProjectSpecific(false);
+ for (int i = 0; i < parameters.length; i++) {
+ String[] parameter = parameters[i].split("=");
+ if (parameter == null || parameter.length == 0) {
+ continue;
+ }
+ String value;
+ try {
+ value = parameter.length > 1 ? URLDecoder.decode(parameter[1], "UTF-8") : "";
+ } catch (UnsupportedEncodingException e) {
+ // this should never never happen
+ IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e);
+ throw new RuntimeException(UTF8_ERROR, e);
+ }
+ if (parameter[0].equals("ivyXmlPath")) {
+ conf.setIvyXmlPath(value);
+ } else if (parameter[0].equals("confs")) {
+ List confs = IvyClasspathUtil.split(value);
+ if (confs.isEmpty()) {
+ confs = Collections.singletonList("*");
+ }
+ conf.setConfs(confs);
+ } else if (parameter[0].equals("ivySettingsPath")) {
+ settingsSetup.setIvySettingsPath(readOldSettings(conf, value));
+ conf.setSettingsProjectSpecific(true);
+ } else if (parameter[0].equals("loadSettingsOnDemand")) {
+ settingsSetup.setLoadSettingsOnDemand(Boolean.valueOf(value).booleanValue());
+ conf.setSettingsProjectSpecific(true);
+ } else if (parameter[0].equals("propertyFiles")) {
+ settingsSetup.setPropertyFiles(IvyClasspathUtil.split(value));
+ conf.setSettingsProjectSpecific(true);
+ } else if (parameter[0].equals("doRetrieve")) {
+ // if the value is not actually "true" or "false", the Boolean class ensure to
+ // return false, so it is fine
+ retrieveSetup.setDoRetrieve(Boolean.valueOf(value).booleanValue());
+ conf.setRetrieveProjectSpecific(true);
+ } else if (parameter[0].equals("retrievePattern")) {
+ retrieveSetup.setRetrievePattern(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (parameter[0].equals("retrieveSync")) {
+ retrieveSetup.setRetrieveSync(Boolean.valueOf(value).booleanValue());
+ conf.setRetrieveProjectSpecific(true);
+ } else if (parameter[0].equals("retrieveConfs")) {
+ retrieveSetup.setRetrieveConfs(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (parameter[0].equals("retrieveTypes")) {
+ retrieveSetup.setRetrieveTypes(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (parameter[0].equals("acceptedTypes")) {
+ mappingSetup.setAcceptedTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("sourceTypes")) {
+ mappingSetup.setSourceTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("javadocTypes")) {
+ mappingSetup.setJavadocTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("sourceSuffixes")) {
+ mappingSetup.setSourceSuffixes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("javadocSuffixes")) {
+ mappingSetup.setJavadocSuffixes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("alphaOrder")) {
+ // if the value is not actually "true" or "false", the Boolean class ensure to
+ // return false, so it is fine
+ conf.setAlphaOrder(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
+ } else if (parameter[0].equals("resolveInWorkspace")) {
+ conf.setResolveInWorkspace(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
+ }
+ }
+ if (conf.isAdvancedProjectSpecific()) {
+ // in this V1 version, it is just some paranoid check
+ checkNonNullConf(conf);
+ }
+ if (conf.isRetrieveProjectSpecific()) {
+ if (retrieveSetup.getRetrievePattern() == null) {
+ retrieveSetup.setRetrievePattern(IvyPlugin.getPreferenceStoreHelper()
+ .getRetrieveSetup().getRetrievePattern());
+ }
+ }
+ }
+
+ private static void loadAttributes(IvyClasspathContainerConfiguration conf,
+ IClasspathAttribute[] attributes) {
+ ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup();
+ RetrieveSetup retrieveSetup = conf.getRetrieveSetup();
+ IvySettingsSetup settingsSetup = conf.getIvySettingsSetup();
+
+ if (attributes != null) {
+ for (int i = 0; i < attributes.length; i++) {
+ String name = attributes[i].getName();
+ String value = attributes[i].getValue();
+ if (name.equals("ivyXmlPath")) {
+ conf.setIvyXmlPath(value);
+ } else if (name.equals("confs")) {
+ List confs = IvyClasspathUtil.split(value);
+ if (confs.isEmpty()) {
+ confs = Collections.singletonList("*");
+ }
+ conf.setConfs(confs);
+ } else if (name.equals("ivySettingsPath")) {
+ settingsSetup.setIvySettingsPath(readOldSettings(conf, value));
+ conf.setSettingsProjectSpecific(true);
+ } else if (name.equals("loadSettingsOnDemand")) {
+ settingsSetup.setLoadSettingsOnDemand(Boolean.valueOf(value).booleanValue());
+ conf.setSettingsProjectSpecific(true);
+ } else if (name.equals("propertyFiles")) {
+ settingsSetup.setPropertyFiles(IvyClasspathUtil.split(value));
+ conf.setSettingsProjectSpecific(true);
+ } else if (name.equals("doRetrieve")) {
+ // if the value is not actually "true" or "false", the Boolean class ensure to
+ // return false, so it is fine
+ retrieveSetup.setDoRetrieve(Boolean.valueOf(value).booleanValue());
+ conf.setRetrieveProjectSpecific(true);
+ } else if (name.equals("retrievePattern")) {
+ retrieveSetup.setRetrievePattern(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (name.equals("retrieveSync")) {
+ retrieveSetup.setRetrieveSync(Boolean.valueOf(value).booleanValue());
+ conf.setRetrieveProjectSpecific(true);
+ } else if (name.equals("retrieveConfs")) {
+ retrieveSetup.setRetrieveConfs(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (name.equals("retrieveTypes")) {
+ retrieveSetup.setRetrieveTypes(value);
+ conf.setRetrieveProjectSpecific(true);
+ } else if (name.equals("acceptedTypes")) {
+ mappingSetup.setAcceptedTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("sourceTypes")) {
+ mappingSetup.setSourceTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("javadocTypes")) {
+ mappingSetup.setJavadocTypes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("sourceSuffixes")) {
+ mappingSetup.setSourceSuffixes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("javadocSuffixes")) {
+ mappingSetup.setJavadocSuffixes(IvyClasspathUtil.split(value));
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("alphaOrder")) {
+ // if the value is not actually "true" or "false", the Boolean class ensure to
+ // return false, so it is fine
+ conf.setAlphaOrder(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
+ } else if (name.equals("resolveInWorkspace")) {
+ conf.setResolveInWorkspace(Boolean.valueOf(value).booleanValue());
+ conf.setAdvancedProjectSpecific(true);
+ } else {
+ conf.addExtraAttribute(attributes[i]);
+ }
+ }
+ }
+ if (conf.isAdvancedProjectSpecific()) {
+ // in this V1 version, it is just some paranoid check
+ checkNonNullConf(conf);
+ }
+ if (conf.isRetrieveProjectSpecific()) {
+ if (retrieveSetup.getRetrievePattern() == null) {
+ retrieveSetup.setRetrievePattern(IvyPlugin.getPreferenceStoreHelper()
+ .getRetrieveSetup().getRetrievePattern());
+ }
+ }
+ }
+
+ /**
+ * Read old configuration that were based on relative urls, like: "file://./ivysettings.xml" or
+ * "file:./ivysettings.xml". This kind of URL "project:///ivysettings.xml" should be used now.
+ *
+ * @param value
+ * the value to read
+ * @return
+ */
+ private static String readOldSettings(IvyClasspathContainerConfiguration conf, String value) {
+ if (FakeProjectManager.isFake(conf.getJavaProject())) {
+ return value;
+ }
+ URL url;
+ try {
+ url = new URL(value);
+ } catch (MalformedURLException e) {
+ return value;
+ }
+ File file = new File(url.getPath());
+ if (file.exists()) {
+ return value;
+ }
+ // the file doesn't exist, it is a relative path to the project.
+ String urlpath = url.getPath();
+ if (urlpath != null && urlpath.startsWith("./")) {
+ urlpath = urlpath.substring(1);
+ }
+ return PROJECT_SCHEME_PREFIX + urlpath;
+ }
+
+ private static void checkNonNullConf(IvyClasspathContainerConfiguration conf) {
+ ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup();
+ IvySettingsSetup settingsSetup = conf.getIvySettingsSetup();
+ ContainerMappingSetup prefStoreMappingSetup = IvyPlugin.getPreferenceStoreHelper()
+ .getContainerMappingSetup();
+ if (settingsSetup.getPropertyFiles() == null) {
+ settingsSetup.setPropertyFiles(IvyPlugin.getPreferenceStoreHelper()
+ .getIvySettingsSetup().getPropertyFiles());
+ }
+ if (mappingSetup.getAcceptedTypes() == null) {
+ mappingSetup.setAcceptedTypes(prefStoreMappingSetup.getAcceptedTypes());
+ }
+ if (mappingSetup.getSourceTypes() == null) {
+ mappingSetup.setSourceTypes(prefStoreMappingSetup.getSourceTypes());
+ }
+ if (mappingSetup.getJavadocTypes() == null) {
+ mappingSetup.setJavadocTypes(prefStoreMappingSetup.getJavadocTypes());
+ }
+ if (mappingSetup.getSourceSuffixes() == null) {
+ mappingSetup.setSourceSuffixes(prefStoreMappingSetup.getSourceSuffixes());
+ }
+ if (mappingSetup.getJavadocSuffixes() == null) {
+ mappingSetup.setJavadocSuffixes(prefStoreMappingSetup.getJavadocSuffixes());
+ }
+ }
+
+ public static IPath getPath(IvyClasspathContainerConfiguration conf) {
+ StringBuffer path = new StringBuffer();
+ path.append('?');
+ path.append("ivyXmlPath=");
+ try {
+ path.append(URLEncoder.encode(conf.getIvyXmlPath(), "UTF-8"));
+ path.append("&confs=");
+ path.append(URLEncoder.encode(IvyClasspathUtil.concat(conf.getConfs()), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e);
+ throw new RuntimeException(UTF8_ERROR, e);
+ }
+ return new Path(IvyClasspathContainer.CONTAINER_ID).append(path.toString());
+ }
+
+ public static IClasspathAttribute[] getAttributes(IvyClasspathContainerConfiguration conf) {
+ List atts = new ArrayList(conf.getExtraAttributes());
+ if (conf.isSettingsProjectSpecific()) {
+ IvySettingsSetup settingsSetup = conf.getIvySettingsSetup();
+ addAttribute(atts, "ivySettingsPath", settingsSetup.getIvySettingsPath());
+ addAttribute(atts, "loadSettingsOnDemand", settingsSetup.isLoadSettingsOnDemand());
+ addAttribute(atts, "propertyFiles", settingsSetup.getPropertyFiles());
+ }
+ if (conf.isRetrieveProjectSpecific()) {
+ RetrieveSetup retrieveSetup = conf.getRetrieveSetup();
+ addAttribute(atts, "doRetrieve", retrieveSetup.isDoRetrieve());
+ addAttribute(atts, "retrievePattern", retrieveSetup.getRetrievePattern());
+ addAttribute(atts, "retrieveSync", retrieveSetup.isRetrieveSync());
+ addAttribute(atts, "retrieveConfs", retrieveSetup.getRetrieveConfs());
+ addAttribute(atts, "retrieveTypes", retrieveSetup.getRetrieveTypes());
+ }
+ if (conf.isAdvancedProjectSpecific()) {
+ ContainerMappingSetup mappingSetup = conf.getContainerMappingSetup();
+ addAttribute(atts, "acceptedTypes", mappingSetup.getAcceptedTypes());
+ addAttribute(atts, "sourceTypes", mappingSetup.getSourceTypes());
+ addAttribute(atts, "javadocTypes", mappingSetup.getJavadocTypes());
+ addAttribute(atts, "sourceSuffixes", mappingSetup.getSourceSuffixes());
+ addAttribute(atts, "javadocSuffixes", mappingSetup.getJavadocSuffixes());
+ addAttribute(atts, "alphaOrder", conf.isAlphaOrder());
+ addAttribute(atts, "resolveInWorkspace", conf.isResolveInWorkspace());
+ }
+ return (IClasspathAttribute[]) atts.toArray(new IClasspathAttribute[0]);
+ }
+
+ private static void addAttribute(List atts, String name, String value) {
+ atts.add(JavaCore.newClasspathAttribute(name, value));
+ }
+
+ private static void addAttribute(List atts, String name, List values) {
+ addAttribute(atts, name, IvyClasspathUtil.concat(values));
+ }
+
+ private static void addAttribute(List atts, String name, boolean bool) {
+ addAttribute(atts, name, Boolean.toString(bool));
+ }
+
+}
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java?rev=814877&r1=814876&r2=814877&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java Mon Sep 14 21:47:44 2009
@@ -17,114 +17,48 @@
*/
package org.apache.ivyde.eclipse.cpcontainer;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.text.ParseException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
-import org.apache.ivy.Ivy;
-import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
-import org.apache.ivy.util.Message;
-import org.apache.ivyde.eclipse.IvyDEException;
import org.apache.ivyde.eclipse.IvyPlugin;
-import org.apache.ivyde.eclipse.workspaceresolver.WorkspaceIvySettings;
-import org.apache.ivyde.eclipse.workspaceresolver.WorkspaceResolver;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IJavaProject;
-import org.osgi.framework.BundleContext;
/**
- * path: org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER? ivyXmlPath=ivy.xml &confs=default
- * &ivySettingsPath=file:///ivysetting.xml &acceptedTypes=jar &sourceTypes=source
- * &javadocTypes=javadoc &sourceSuffixes=-sources,-source,-src
- * &javadocSuffixes=-javadocs,-javadoc,-doc,-docs &doRetrieve=true
- * &retrievePattern=lib/[conf]/[artifact].[ext] &alphaOrder=true
+ * This class is just a simple bean defining the properties which configure an IvyDE classpath
+ * container.
*/
public class IvyClasspathContainerConfiguration {
- private static final String UTF8_ERROR = "The UTF-8 encoding support is required"
- + " is decode the path of the container.";
+ private final IJavaProject javaProject;
- private static final String PROJECT_SCHEME_PREFIX = "project://";
+ private IvySettingsSetup ivySettingsSetup = new IvySettingsSetup();
- private static final int PROJECT_SCHEME_PREFIX_LENGTH = PROJECT_SCHEME_PREFIX.length();
+ private ContainerMappingSetup containerMappingSetup = new ContainerMappingSetup();
- final IJavaProject javaProject;
+ private RetrieveSetup retrieveSetup = new RetrieveSetup();
- String ivyXmlPath;
+ private String ivyXmlPath;
- List/* <String> */confs = Arrays.asList(new String[] {"*"});
+ private List/* <String> */confs = Arrays.asList(new String[] {"*"});
- String ivySettingsPath;
+ private boolean alphaOrder;
- List/* <String> */propertyFiles;
+ private boolean resolveInWorkspace;
- List/* <String> */acceptedTypes;
+ private boolean isAdvancedProjectSpecific;
- List/* <String> */sourceTypes;
+ private boolean isRetrieveProjectSpecific;
- List/* <String> */javadocTypes;
+ private boolean isSettingsProjectSpecific;
- List/* <String> */sourceSuffixes;
-
- List/* <String> */javadocSuffixes;
-
- boolean doRetrieve;
-
- String retrievePattern;
-
- boolean retrieveSync = false;
-
- String retrieveConfs = "*";
-
- String retrieveTypes = "*";
-
- boolean alphaOrder;
-
- boolean resolveInWorkspace;
-
- private Ivy ivy;
-
- long ivySettingsLastModified = -1;
-
- boolean confOk;
-
- private final boolean editing;
-
- boolean isAdvancedProjectSpecific;
-
- boolean isRetrieveProjectSpecific;
-
- boolean isSettingsSpecific;
-
- boolean loadSettingsOnDemand = false;
-
- private ModuleDescriptor md;
+ /**
+ * attributes attached to the container but not IvyDE related (Webtools or AspectJfor instance)
+ */
+ private List/* <IClasspathAttribute> */extraAttributes = new ArrayList();
/**
* Constructor
@@ -141,7 +75,6 @@
boolean editing) {
this.javaProject = javaProject;
this.ivyXmlPath = ivyXmlPath;
- this.editing = editing;
}
/**
@@ -154,531 +87,135 @@
* @param editing
* if set to true, this bean will be used for edition purpose, so no need to trigger
* UI notification about some errors in there
+ * @param attributes
*/
- public IvyClasspathContainerConfiguration(IJavaProject javaProject, IPath path, boolean editing) {
+ public IvyClasspathContainerConfiguration(IJavaProject javaProject, IPath path,
+ boolean editing, IClasspathAttribute[] attributes) {
this.javaProject = javaProject;
- this.editing = editing;
- if (path.segmentCount() > 2) {
- loadV0(path);
- } else {
- loadV1(path);
- }
+ IvyClasspathContainerConfAdapter.load(this, path, attributes);
}
- public String toString() {
- return ivyXmlPath
- + (javaProject == null ? "" : " in '" + javaProject.getProject().getName() + "'");
+ // ///////////////////////////
+ // Simple setters and getters
+ // ///////////////////////////
+
+ public String getIvyXmlPath() {
+ return ivyXmlPath;
}
- /**
- * Load the pre-IVYDE-70 configuration
- *
- * @param path
- * the path of the container
- */
- private void loadV0(IPath path) {
- // load some configuration that can be loaded
- ivyXmlPath = path.removeFirstSegments(1).removeLastSegments(1).toString();
- confs = IvyClasspathUtil.split(path.lastSegment());
- if (confs.isEmpty()) {
- confs = Collections.singletonList("*");
- }
- // the last part of the configuration coming from the preferences cannot be loaded due to
- // the bug described in IVYDE-70, so the configuration is let as the default one
+ public void setIvyXmlPath(String ivyXmlPath) {
+ this.ivyXmlPath = ivyXmlPath;
}
- /**
- * Load the post-IVYDE-70 configuration
- *
- * @param path
- * the path of the container
- */
- private void loadV1(IPath path) {
- String url = path.segment(1).substring(1);
- String[] parameters = url.split("&");
- isAdvancedProjectSpecific = false;
- isRetrieveProjectSpecific = false;
- isSettingsSpecific = false;
- for (int i = 0; i < parameters.length; i++) {
- String[] parameter = parameters[i].split("=");
- if (parameter == null || parameter.length == 0) {
- continue;
- }
- String value;
- try {
- value = parameter.length > 1 ? URLDecoder.decode(parameter[1], "UTF-8") : "";
- } catch (UnsupportedEncodingException e) {
- // this should never never happen
- IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e);
- throw new RuntimeException(UTF8_ERROR, e);
- }
- if (parameter[0].equals("ivyXmlPath")) {
- ivyXmlPath = value;
- } else if (parameter[0].equals("confs")) {
- confs = IvyClasspathUtil.split(value);
- if (confs.isEmpty()) {
- confs = Collections.singletonList("*");
- }
- } else if (parameter[0].equals("ivySettingsPath")) {
- ivySettingsPath = readOldIvySettings(value);
- isSettingsSpecific = true;
- } else if (parameter[0].equals("loadSettingsOnDemand")) {
- loadSettingsOnDemand = Boolean.valueOf(value).booleanValue();
- isSettingsSpecific = true;
- } else if (parameter[0].equals("propertyFiles")) {
- propertyFiles = IvyClasspathUtil.split(value);
- isSettingsSpecific = true;
- } else if (parameter[0].equals("doRetrieve")) {
- // if the value is not actually "true" or "false", the Boolean class ensure to
- // return false, so it is fine
- doRetrieve = Boolean.valueOf(value).booleanValue();
- isRetrieveProjectSpecific = true;
- } else if (parameter[0].equals("retrievePattern")) {
- retrievePattern = value;
- isRetrieveProjectSpecific = true;
- } else if (parameter[0].equals("retrieveSync")) {
- retrieveSync = Boolean.valueOf(value).booleanValue();
- isRetrieveProjectSpecific = true;
- } else if (parameter[0].equals("retrieveConfs")) {
- retrieveConfs = value;
- isRetrieveProjectSpecific = true;
- } else if (parameter[0].equals("retrieveTypes")) {
- retrieveTypes = value;
- isRetrieveProjectSpecific = true;
- } else if (parameter[0].equals("acceptedTypes")) {
- acceptedTypes = IvyClasspathUtil.split(value);
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("sourceTypes")) {
- sourceTypes = IvyClasspathUtil.split(value);
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("javadocTypes")) {
- javadocTypes = IvyClasspathUtil.split(value);
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("sourceSuffixes")) {
- sourceSuffixes = IvyClasspathUtil.split(value);
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("javadocSuffixes")) {
- javadocSuffixes = IvyClasspathUtil.split(value);
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("alphaOrder")) {
- // if the value is not actually "true" or "false", the Boolean class ensure to
- // return false, so it is fine
- alphaOrder = Boolean.valueOf(value).booleanValue();
- isAdvancedProjectSpecific = true;
- } else if (parameter[0].equals("resolveInWorkspace")) {
- resolveInWorkspace = Boolean.valueOf(value).booleanValue();
- isAdvancedProjectSpecific = true;
- }
- }
- if (isAdvancedProjectSpecific) {
- // in this V1 version, it is just some paranoid check
- checkNonNullConf();
- }
- if (isRetrieveProjectSpecific) {
- if (retrievePattern == null) {
- retrievePattern = IvyPlugin.getPreferenceStoreHelper().getRetrievePattern();
- }
- }
+ public List getConfs() {
+ return confs;
}
- /**
- * Read old configuration that were based on relative urls, like: "file://./ivysettings.xml" or
- * "file:./ivysettings.xml". This kind of URL "project:///ivysettings.xml" should be used now.
- *
- * @param value
- * the value to read
- * @return
- */
- private String readOldIvySettings(String value) {
- if (javaProject == null) {
- return value;
- }
- URL url;
- try {
- url = new URL(value);
- } catch (MalformedURLException e) {
- return value;
- }
- File file = new File(url.getPath());
- if (file.exists()) {
- return value;
- }
- // the file doesn't exist, it is a relative path to the project.
- String urlpath = url.getPath();
- if (urlpath != null && urlpath.startsWith("./")) {
- urlpath = urlpath.substring(1);
- }
- return PROJECT_SCHEME_PREFIX + urlpath;
- }
-
- private void checkNonNullConf() {
- if (acceptedTypes == null) {
- acceptedTypes = IvyPlugin.getPreferenceStoreHelper().getAcceptedTypes();
- }
- if (propertyFiles == null) {
- propertyFiles = IvyPlugin.getPreferenceStoreHelper().getPropertyFiles();
- }
- if (sourceTypes == null) {
- sourceTypes = IvyPlugin.getPreferenceStoreHelper().getSourceTypes();
- }
- if (javadocTypes == null) {
- javadocTypes = IvyPlugin.getPreferenceStoreHelper().getJavadocTypes();
- }
- if (sourceSuffixes == null) {
- sourceSuffixes = IvyPlugin.getPreferenceStoreHelper().getSourceSuffixes();
- }
- if (javadocSuffixes == null) {
- javadocSuffixes = IvyPlugin.getPreferenceStoreHelper().getJavadocSuffixes();
- }
- }
-
- public IPath getPath() {
- StringBuffer path = new StringBuffer();
- path.append('?');
- path.append("ivyXmlPath=");
- try {
- path.append(URLEncoder.encode(ivyXmlPath, "UTF-8"));
- path.append("&confs=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(confs), "UTF-8"));
- if (isSettingsSpecific) {
- path.append("&ivySettingsPath=");
- path.append(URLEncoder.encode(ivySettingsPath, "UTF-8"));
- path.append("&loadSettingsOnDemand=");
- path.append(URLEncoder.encode(Boolean.toString(loadSettingsOnDemand), "UTF-8"));
- path.append("&propertyFiles=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(propertyFiles), "UTF-8"));
- }
- if (isRetrieveProjectSpecific) {
- path.append("&doRetrieve=");
- path.append(URLEncoder.encode(Boolean.toString(doRetrieve), "UTF-8"));
- path.append("&retrievePattern=");
- path.append(URLEncoder.encode(retrievePattern, "UTF-8"));
- path.append("&retrieveSync=");
- path.append(URLEncoder.encode(Boolean.toString(retrieveSync), "UTF-8"));
- path.append("&retrieveConfs=");
- path.append(URLEncoder.encode(retrieveConfs, "UTF-8"));
- path.append("&retrieveTypes=");
- path.append(URLEncoder.encode(retrieveTypes, "UTF-8"));
- }
- if (isAdvancedProjectSpecific) {
- path.append("&acceptedTypes=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(acceptedTypes), "UTF-8"));
- path.append("&sourceTypes=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(sourceTypes), "UTF-8"));
- path.append("&javadocTypes=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(javadocTypes), "UTF-8"));
- path.append("&sourceSuffixes=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(sourceSuffixes), "UTF-8"));
- path.append("&javadocSuffixes=");
- path.append(URLEncoder.encode(IvyClasspathUtil.concat(javadocSuffixes), "UTF-8"));
- path.append("&alphaOrder=");
- path.append(URLEncoder.encode(Boolean.toString(alphaOrder), "UTF-8"));
- path.append("&resolveInWorkspace=");
- path.append(URLEncoder.encode(Boolean.toString(this.resolveInWorkspace), "UTF-8"));
- }
- } catch (UnsupportedEncodingException e) {
- IvyPlugin.log(IStatus.ERROR, UTF8_ERROR, e);
- throw new RuntimeException(UTF8_ERROR, e);
- }
- return new Path(IvyClasspathContainer.CONTAINER_ID).append(path.toString());
+ public void setConfs(List confs) {
+ this.confs = confs;
}
- public String getIvyXmlPath() {
- return ivyXmlPath;
+ public IvySettingsSetup getIvySettingsSetup() {
+ return ivySettingsSetup;
+ }
+
+ public void setIvySettingsSetup(IvySettingsSetup ivySettingsSetup) {
+ this.ivySettingsSetup = ivySettingsSetup;
+ }
+
+ public ContainerMappingSetup getContainerMappingSetup() {
+ return containerMappingSetup;
+ }
+
+ public void setContainerMappingSetup(ContainerMappingSetup containerMappingSetup) {
+ this.containerMappingSetup = containerMappingSetup;
+ }
+
+ public RetrieveSetup getRetrieveSetup() {
+ return retrieveSetup;
+ }
+
+ public void setRetrieveSetup(RetrieveSetup retrieveSetup) {
+ this.retrieveSetup = retrieveSetup;
+ }
+
+ public boolean isAlphaOrder() {
+ return alphaOrder;
+ }
+
+ public void setAlphaOrder(boolean alphaOrder) {
+ this.alphaOrder = alphaOrder;
+ }
+
+ public boolean isResolveInWorkspace() {
+ return resolveInWorkspace;
+ }
+
+ public void setResolveInWorkspace(boolean resolveInWorkspace) {
+ this.resolveInWorkspace = resolveInWorkspace;
+ }
+
+ public boolean isAdvancedProjectSpecific() {
+ return isAdvancedProjectSpecific;
+ }
+
+ public void setAdvancedProjectSpecific(boolean isAdvancedProjectSpecific) {
+ this.isAdvancedProjectSpecific = isAdvancedProjectSpecific;
+ }
+
+ public boolean isRetrieveProjectSpecific() {
+ return isRetrieveProjectSpecific;
+ }
+
+ public void setRetrieveProjectSpecific(boolean isRetrieveProjectSpecific) {
+ this.isRetrieveProjectSpecific = isRetrieveProjectSpecific;
+ }
+
+ public boolean isSettingsProjectSpecific() {
+ return isSettingsProjectSpecific;
+ }
+
+ public void setSettingsProjectSpecific(boolean isSettingsProjectSpecific) {
+ this.isSettingsProjectSpecific = isSettingsProjectSpecific;
}
public IJavaProject getJavaProject() {
return javaProject;
}
- public List getConfs() {
- return confs;
+ public void addExtraAttribute(IClasspathAttribute attribute) {
+ extraAttributes.add(attribute);
}
- private void setConfStatus(IvyDEException ex) {
- if (!editing) {
- confOk = (ex == null);
- if (ex != null) {
- setResolveStatus(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, ex
- .getMessage(), ex.getCause()));
- } else {
- setResolveStatus(Status.OK_STATUS);
- }
- }
- }
-
- public void setResolveStatus(IStatus status) {
- if (!editing && javaProject != null) {
- IProject p = javaProject.getProject();
- try {
- p.deleteMarkers(IvyPlugin.MARKER_ID, true, IResource.DEPTH_INFINITE);
- if (status == Status.OK_STATUS) {
- return;
- }
- IResource r = javaProject.getProject().getFile(ivyXmlPath);
- if (!r.exists()) {
- r = p;
- }
- IMarker marker = r.createMarker(IvyPlugin.MARKER_ID);
- marker.setAttribute(IMarker.MESSAGE, status.getMessage());
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
- break;
- case IStatus.WARNING:
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
- break;
- case IStatus.INFO:
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
- break;
- default:
- IvyPlugin.log(IStatus.WARNING, "Unsupported resolve status: "
- + status.getSeverity(), null);
- }
- } catch (CoreException e) {
- IvyPlugin.log(e);
- }
- }
- }
-
- public Ivy getCachedIvy() throws IvyDEException {
- if (ivy != null) {
- return ivy;
- }
- return getIvy();
- }
-
- public Ivy getIvy() throws IvyDEException {
- try {
- return doGetIvy();
- } catch (IvyDEException e) {
- e.contextualizeMessage("Error while resolving the ivy instance for " + this.toString());
- throw e;
- }
- }
-
- private Ivy doGetIvy() throws IvyDEException {
- String settingsPath = getInheritedIvySettingsPath();
- if (settingsPath == null || settingsPath.trim().length() == 0) {
- // no settings specified, so take the default one
- if (ivy == null) {
- IvySettings ivySettings = createIvySettings();
- try {
- ivySettings.loadDefault();
- } catch (ParseException e) {
- IvyDEException ex = new IvyDEException(
- "Parsing error of the default Ivy settings",
- "The default Ivy settings file could not be parsed: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- } catch (IOException e) {
- IvyDEException ex = new IvyDEException(
- "Read error of the default Ivy settings",
- "The default Ivy settings file could not be read: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- }
- ivy = Ivy.newInstance(ivySettings);
- }
- setConfStatus(null);
- return ivy;
- }
-
- if (settingsPath.startsWith(PROJECT_SCHEME_PREFIX)) {
- int pathIndex = settingsPath.indexOf("/", PROJECT_SCHEME_PREFIX_LENGTH);
- String projectName = settingsPath.substring(PROJECT_SCHEME_PREFIX_LENGTH, pathIndex);
- String path = settingsPath.substring(pathIndex + 1);
- if (projectName.equals("")) {
- File file = javaProject.getProject().getFile(path).getLocation().toFile();
- if (!file.exists()) {
- IvyDEException ex = new IvyDEException("Ivy settings file not found",
- "The Ivy settings file '" + settingsPath + "' cannot be found", null);
- setConfStatus(ex);
- throw ex;
- }
- return getIvy(file);
- } else {
- IResource p = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
- if (p == null) {
- IvyDEException ex = new IvyDEException("Project '" + projectName
- + "' not found", "The project name '" + projectName + "' from '"
- + settingsPath + "' was not found", null);
- setConfStatus(ex);
- throw ex;
- }
- File file = p.getProject().getFile(path).getLocation().toFile();
- if (!file.exists()) {
- IvyDEException ex = new IvyDEException("Ivy settings file not found",
- "The Ivy settings file '" + path + "' cannot be found in project '"
- + projectName + "'", null);
- setConfStatus(ex);
- throw ex;
- }
- return getIvy(file);
- }
- }
- // before returning the found ivy, try to refresh it if the settings changed
- URL url;
- try {
- url = new URL(settingsPath);
- } catch (MalformedURLException e) {
- IvyDEException ex = new IvyDEException("Incorrect url of the Ivy settings",
- "The Ivy settings url '" + settingsPath + "' is incorrect: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- }
- if (url.getProtocol().startsWith("file")) {
- File file = new File(url.getPath());
- return getIvy(file);
- } else {
- // an URL but not a file
- if (ivy == null || ivySettingsLastModified == -1) {
- IvySettings ivySettings = createIvySettings();
- try {
- ivySettings.load(url);
- ivySettingsLastModified = 0;
- } catch (ParseException e) {
- IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
- "The ivy settings file '" + settingsPath + "' could not be parsed: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- } catch (IOException e) {
- IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
- "The ivy settings file '" + settingsPath + "' could not be read: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- }
- ivy = Ivy.newInstance(ivySettings);
- }
- }
- setConfStatus(null);
- return ivy;
- }
-
- private Ivy getIvy(File file) throws IvyDEException {
- if (!file.exists()) {
- IvyDEException ex = new IvyDEException("Ivy settings file not found",
- "The Ivy settings file '" + ivySettingsPath + "' cannot be found", null);
- setConfStatus(ex);
- throw ex;
- }
-
- if (file.lastModified() != ivySettingsLastModified
- || !getInheritedLoadSettingsOnDemandPath()) {
- IvySettings ivySettings = createIvySettings();
- if (ivySettingsLastModified == -1) {
- Message.info("\n\n");
- } else {
- Message.info("\n\nIVYDE: ivysettings has changed, configuring ivy again\n");
- }
- try {
- ivySettings.load(file);
- } catch (ParseException e) {
- IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
- "The ivy settings file '" + ivySettingsPath + "' could not be parsed: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- } catch (IOException e) {
- IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
- "The ivy settings file '" + ivySettingsPath + "' could not be read: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- }
- ivy = Ivy.newInstance(ivySettings);
- ivySettingsLastModified = file.lastModified();
- }
- return ivy;
- }
-
- private IvySettings createIvySettings() throws IvyDEException {
- IvySettings ivySettings;
- if (isInheritedResolveInWorkspace()) {
- ivySettings = new WorkspaceIvySettings(javaProject);
- DefaultRepositoryCacheManager cacheManager = new DefaultRepositoryCacheManager();
- BundleContext bundleContext = IvyPlugin.getDefault().getBundleContext();
- cacheManager.setBasedir(bundleContext.getDataFile("ivyde-workspace-resolver-cache"));
- cacheManager.setCheckmodified(true);
- cacheManager.setUseOrigin(true);
- cacheManager.setName(WorkspaceResolver.CACHE_NAME);
- ivySettings.addRepositoryCacheManager(cacheManager);
- } else {
- ivySettings = new IvySettings();
- }
- if (javaProject != null) {
- ivySettings.setBaseDir(javaProject.getProject().getLocation().toFile());
- }
- Collection propFiles = getInheritedPropertyFiles();
- if (propFiles != null) {
- Iterator iter = propFiles.iterator();
- while (iter.hasNext()) {
- String file = (String) iter.next();
- InputStream is;
- Path p = new Path(file);
- if (javaProject != null && !p.isAbsolute()) {
- try {
- is = new FileInputStream(javaProject.getProject().getFile(file)
- .getFullPath().toFile());
- } catch (FileNotFoundException e) {
- IvyDEException ex = new IvyDEException("Property file not found",
- "The property file '" + file + "' could not be found", e);
- setConfStatus(ex);
- throw ex;
- }
- } else {
- try {
- is = new FileInputStream(file);
- } catch (FileNotFoundException e) {
- IvyDEException ex = new IvyDEException("Property file not found",
- "The property file '" + file + "' was not found", e);
- setConfStatus(ex);
- throw ex;
- }
- }
- Properties props = new Properties();
- try {
- props.load(is);
- } catch (IOException e) {
- IvyDEException ex = new IvyDEException("Not a property file",
- "The property file '" + file + "' could not be loaded", e);
- setConfStatus(ex);
- throw ex;
- }
- try {
- is.close();
- } catch (IOException e) {
- // don't care
- }
-
- Iterator keys = props.keySet().iterator();
- while (keys.hasNext()) {
- String key = (String) keys.next();
- String value = props.getProperty(key);
- ivySettings.setVariable(key, value);
- }
- }
- }
- return ivySettings;
+ public List/* <IClasspathAttribute> */getExtraAttributes() {
+ return extraAttributes;
}
+ // ///////////////////////////
+ // Getters that take into account the global preferences
+ // ///////////////////////////
+
public String getInheritedIvySettingsPath() {
- if (!isSettingsSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getIvySettingsPath();
+ if (!isSettingsProjectSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getIvySettingsSetup().getIvySettingsPath();
}
- return ivySettingsPath;
+ return ivySettingsSetup.getIvySettingsPath();
}
public boolean getInheritedLoadSettingsOnDemandPath() {
- if (!isSettingsSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getLoadSettingsOnDemand();
+ if (!isSettingsProjectSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getIvySettingsSetup()
+ .isLoadSettingsOnDemand();
+ }
+ return ivySettingsSetup.isLoadSettingsOnDemand();
+ }
+
+ public Collection getInheritedPropertyFiles() {
+ if (!isSettingsProjectSpecific) {
+ return IvyPlugin.getPreferenceStoreHelper().getIvySettingsSetup().getPropertyFiles();
+ } else {
+ return ivySettingsSetup.getPropertyFiles();
}
- return loadSettingsOnDemand;
}
public boolean getInheritedDoRetrieve() {
@@ -687,72 +224,76 @@
return false;
}
if (!isRetrieveProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getDoRetrieve();
+ return IvyPlugin.getPreferenceStoreHelper().getRetrieveSetup().isDoRetrieve();
}
- return doRetrieve;
+ return retrieveSetup.isDoRetrieve();
}
public String getInheritedRetrievePattern() {
if (!isRetrieveProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getRetrievePattern();
+ return IvyPlugin.getPreferenceStoreHelper().getRetrieveSetup().getRetrievePattern();
}
- return retrievePattern;
+ return retrieveSetup.getRetrievePattern();
}
public String getInheritedRetrieveConfs() {
if (!isRetrieveProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getRetrieveConfs();
+ return IvyPlugin.getPreferenceStoreHelper().getRetrieveSetup().getRetrieveConfs();
}
- return retrieveConfs;
+ return retrieveSetup.getRetrieveConfs();
}
public String getInheritedRetrieveTypes() {
if (!isRetrieveProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getRetrieveTypes();
+ return IvyPlugin.getPreferenceStoreHelper().getRetrieveSetup().getRetrieveTypes();
}
- return retrieveTypes;
+ return retrieveSetup.getRetrieveTypes();
}
public boolean getInheritedRetrieveSync() {
if (!isRetrieveProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getRetrieveSync();
+ return IvyPlugin.getPreferenceStoreHelper().getRetrieveSetup().isRetrieveSync();
}
- return retrieveSync;
+ return retrieveSetup.isRetrieveSync();
}
public Collection getInheritedAcceptedTypes() {
if (!isAdvancedProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getAcceptedTypes();
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .getAcceptedTypes();
}
- return acceptedTypes;
+ return containerMappingSetup.getAcceptedTypes();
}
public Collection getInheritedSourceTypes() {
if (!isAdvancedProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getSourceTypes();
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup().getSourceTypes();
}
- return sourceTypes;
+ return containerMappingSetup.getSourceTypes();
}
public Collection getInheritedSourceSuffixes() {
if (!isAdvancedProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getSourceSuffixes();
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .getSourceSuffixes();
}
- return sourceSuffixes;
+ return containerMappingSetup.getSourceSuffixes();
}
public Collection getInheritedJavadocTypes() {
if (!isAdvancedProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getJavadocTypes();
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .getJavadocTypes();
}
- return javadocTypes;
+ return containerMappingSetup.getJavadocTypes();
}
public Collection getInheritedJavadocSuffixes() {
if (!isAdvancedProjectSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getJavadocSuffixes();
+ return IvyPlugin.getPreferenceStoreHelper().getContainerMappingSetup()
+ .getJavadocSuffixes();
}
- return javadocSuffixes;
+ return containerMappingSetup.getJavadocSuffixes();
}
public boolean isInheritedAlphaOrder() {
@@ -769,79 +310,9 @@
return resolveInWorkspace;
}
- public boolean isSettingsProjectSpecific() {
- return isSettingsSpecific;
- }
-
- public boolean isAdvancedProjectSpecific() {
- return isAdvancedProjectSpecific;
- }
-
- public boolean isRetrieveProjectSpecific() {
- return isRetrieveProjectSpecific;
- }
-
- public File getIvyFile() {
- File file;
- if (javaProject != null) {
- IFile f = javaProject.getProject().getFile(ivyXmlPath);
- file = f.getLocation().toFile();
- } else {
- file = new File(ivyXmlPath);
- }
- return file;
- }
-
- public ModuleDescriptor getCachedModuleDescriptor() throws IvyDEException {
- if (md != null) {
- return md;
- }
- return getModuleDescriptor(getCachedIvy());
- }
-
- public ModuleDescriptor getModuleDescriptor() throws IvyDEException {
- return getModuleDescriptor(getIvy());
- }
-
- public ModuleDescriptor getModuleDescriptor(Ivy i) throws IvyDEException {
- File file = getIvyFile();
- if (!file.exists()) {
- IvyDEException ex = new IvyDEException("Ivy file not found", "The ivy.xml file '"
- + file.getAbsolutePath() + "' was not found", null);
- setConfStatus(ex);
- throw ex;
- }
- try {
- md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
- i.getSettings(), file.toURL(), false);
- setConfStatus(null);
- return md;
- } catch (MalformedURLException e) {
- IvyDEException ex = new IvyDEException("Incorrect URL of the Ivy file",
- "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath() + "'", e);
- setConfStatus(ex);
- throw ex;
- } catch (ParseException e) {
- IvyDEException ex = new IvyDEException("Parsing error of the Ivy file",
- "The ivy file '" + file.getAbsolutePath() + "' could not be parsed: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- } catch (IOException e) {
- IvyDEException ex = new IvyDEException("Read error of the Ivy file", "The ivy file '"
- + file.getAbsolutePath() + "' could not be read: "
- + e.getMessage(), e);
- setConfStatus(ex);
- throw ex;
- }
- }
-
- public Collection getInheritedPropertyFiles() {
- if (!isSettingsSpecific) {
- return IvyPlugin.getPreferenceStoreHelper().getPropertyFiles();
- } else {
- return propertyFiles;
- }
+ public String toString() {
+ return ivyXmlPath
+ + (javaProject == null ? "" : " in '" + javaProject.getProject().getName() + "'");
}
}