Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 182412 Details for
Bug 30440
Provide an ant task for setting the derived bit.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch v.0.1
patch30440_201011041930.txt (text/plain), 6.20 KB, created by
Szymon Ptaszkiewicz
on 2010-11-04 14:45:47 EDT
(
hide
)
Description:
Patch v.0.1
Filename:
MIME Type:
Creator:
Szymon Ptaszkiewicz
Created:
2010-11-04 14:45:47 EDT
Size:
6.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/plugin.xml,v >retrieving revision 1.88 >diff -u -r1.88 plugin.xml >--- plugin.xml 8 Mar 2010 22:53:15 -0000 1.88 >+++ plugin.xml 4 Nov 2010 18:43:14 -0000 >@@ -134,6 +134,11 @@ > name="eclipse.refreshLocal" > class="org.eclipse.core.resources.ant.RefreshLocalTask"> > </antTask> >+ <antTask >+ library="ant_tasks/resources-ant.jar" >+ name="eclipse.setDerived" >+ class="org.eclipse.core.resources.ant.SetDerived"> >+ </antTask> > </extension> > <!-- Extra Classpath --> > <extension >Index: src_ant/org/eclipse/core/resources/ant/RefreshLocalTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src_ant/org/eclipse/core/resources/ant/RefreshLocalTask.java,v >retrieving revision 1.13 >diff -u -r1.13 RefreshLocalTask.java >--- src_ant/org/eclipse/core/resources/ant/RefreshLocalTask.java 4 Apr 2006 20:53:47 -0000 1.13 >+++ src_ant/org/eclipse/core/resources/ant/RefreshLocalTask.java 4 Nov 2010 18:43:14 -0000 >@@ -68,7 +68,7 @@ > */ > public void execute() throws BuildException { > if (resource == null) >- throw new BuildException(Policy.bind("exception.resourceNotSpecified")); //$NON-NLS-1$ >+ throw new BuildException(Policy.bind("exception.resourceNotSpecified", "eclipse.refreshLocal")); //$NON-NLS-1$ //$NON-NLS-2$ > try { > IProgressMonitor monitor = null; > Hashtable references = getProject().getReferences(); >Index: src_ant/org/eclipse/core/resources/ant/SetDerived.java >=================================================================== >RCS file: src_ant/org/eclipse/core/resources/ant/SetDerived.java >diff -N src_ant/org/eclipse/core/resources/ant/SetDerived.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/core/resources/ant/SetDerived.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.resources.ant; >+ >+import java.util.Hashtable; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.ant.core.AntCorePlugin; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.*; >+ >+/** >+ * An Ant task which sets derived flag for the given resource. >+ * >+ * @see IResource#setDerived(boolean, IProgressMonitor) >+ */ >+public class SetDerived extends Task { >+ private boolean derived = true; >+ private boolean recurse = false; >+ private IPath resourcePath = null; >+ >+ public SetDerived() { >+ super(); >+ } >+ >+ private void setDerived(IResource resource, IProgressMonitor monitor) throws CoreException { >+ resource.setDerived(derived, monitor); >+ if (recurse && (resource instanceof IContainer)) { >+ IResource members[] = ((IContainer) resource).members(); >+ for (int i = 0; i < members.length; i++) { >+ setDerived(members[i], monitor); >+ } >+ } >+ } >+ >+ /** >+ * Executes this task. >+ * >+ * @exception BuildException thrown if a problem occurs during execution. >+ */ >+ public void execute() throws BuildException { >+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(resourcePath); >+ if (resource == null) >+ throw new BuildException(Policy.bind("exception.resourceNotSpecified", "eclipse.setDerived")); //$NON-NLS-1$ //$NON-NLS-2$ >+ try { >+ IProgressMonitor monitor = null; >+ Hashtable references = getProject().getReferences(); >+ if (references != null) >+ monitor = (IProgressMonitor) references.get(AntCorePlugin.ECLIPSE_PROGRESS_MONITOR); >+ setDerived(resource, monitor); >+ } catch (CoreException e) { >+ throw new BuildException(e); >+ } >+ } >+ >+ /** >+ * Sets the derived flag to be used in this task. >+ * >+ * @param value the derived value >+ */ >+ public void setDerived(String value) { >+ derived = Boolean.parseBoolean(value); >+ } >+ >+ /** >+ * Sets the recurse flag. If <code>true</code> then derived flag will be set for the given resource and all its children. If <code>false</code> then it will be set only for the given resource. >+ * >+ * @param value the recurse value >+ */ >+ public void setRecurse(String value) { >+ recurse = Boolean.parseBoolean(value); >+ } >+ >+ /** >+ * Sets the resource path for which {@link IResource#setDerived(boolean, IProgressMonitor)} will be called. >+ * >+ * @param value the resource path >+ */ >+ public void setResourcePath(String value) { >+ resourcePath = new Path(value); >+ } >+} >Index: src_ant/org/eclipse/core/resources/ant/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src_ant/org/eclipse/core/resources/ant/messages.properties,v >retrieving revision 1.11 >diff -u -r1.11 messages.properties >--- src_ant/org/eclipse/core/resources/ant/messages.properties 8 Jun 2005 20:50:25 -0000 1.11 >+++ src_ant/org/eclipse/core/resources/ant/messages.properties 4 Nov 2010 18:43:15 -0000 >@@ -18,5 +18,5 @@ > exception.noProjectMatchThePath=The path {0} does not match any existing project. > exception.pathNotValid=The path {0} for the resource is not a valid path as the first segment does not represent a project. > exception.propertyAndPathIdNotSpecified=At least one of the "property" or "pathId" attributes must be specified. >-exception.resourceNotSpecified=A resource name must be specified for the eclipse.refreshLocal task. >+exception.resourceNotSpecified=A resource name must be specified for the {0} task. > warning.projectDoesNotExist=Warning: project {0} does not exist and cannot be refreshed.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30440
: 182412