woproject/projects/wolips/plugins/org.objectstyle.wolips/java/org/objectstyle/wolips/core/resources/internal/types/file PBDotProjectAdapter.java,1.5,1.6
[email protected] Tue, 18 Apr 2006 11:18:07 -0700 (PDT)
| Newsgroups | gmane.comp.web.webobjects.woproject.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips/java/org/objectstyle/wolips/core/resources/internal/types/file
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4140/java/org/objectstyle/wolips/core/resources/internal/types/file
Modified Files:
PBDotProjectAdapter.java
Log Message:
subprojects support for pb.project
Index: PBDotProjectAdapter.java
===================================================================
RCS file: /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips/java/org/objectstyle/wolips/core/resources/internal/types/file/PBDotProjectAdapter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- PBDotProjectAdapter.java 15 Nov 2005 17:30:51 -0000 1.5
+++ PBDotProjectAdapter.java 18 Apr 2006 18:17:48 -0000 1.6
@@ -68,227 +68,282 @@
import org.objectstyle.wolips.core.CorePlugin;
import org.objectstyle.wolips.core.resources.types.ILocalizedPath;
import org.objectstyle.wolips.core.resources.types.file.IPBDotProjectAdapter;
+import org.objectstyle.wolips.core.resources.types.folder.IDotSubprojAdapter;
import org.objectstyle.wolips.core.resources.types.project.IProjectAdapter;
-public class PBDotProjectAdapter extends AbstractFileAdapter implements IPBDotProjectAdapter {
- // local framework search for PB.project
- private static final String DefaultLocalFrameworkSearch = "$(NEXT_ROOT)$(LOCAL_LIBRARY_DIR)/Frameworks";
+public class PBDotProjectAdapter extends AbstractFileAdapter implements
+ IPBDotProjectAdapter {
+ // local framework search for PB.project
+ private static final String DefaultLocalFrameworkSearch = "$(NEXT_ROOT)$(LOCAL_LIBRARY_DIR)/Frameworks";
- private boolean saveRequired = false;
- private boolean rebuildRequired = false;
+ private boolean saveRequired = false;
- private PBProject pbProject;
+ private boolean rebuildRequired = false;
- public PBDotProjectAdapter(IFile underlyingFile) {
- super(underlyingFile);
- this.initPBProject();
- }
-
- public boolean isRebuildRequired() {
- return rebuildRequired;
- }
+ private PBProject pbProject;
- public void save(IProgressMonitor monitor) {
- if (this.pbProject == null) {
- return;
- }
- if (!this.saveRequired) {
- return;
- }
- this.saveRequired = false;
- this.pbProject.saveChanges();
- try {
- this.getUnderlyingFile().refreshLocal(IResource.DEPTH_ZERO, monitor);
- }
- catch (CoreException up) {
- CorePlugin.getDefault().debug(this.getClass().getName() + "Error while saving PB.project: " + this.getUnderlyingFile(), up);
- }
- }
+ public PBDotProjectAdapter(IFile underlyingFile) {
+ super(underlyingFile);
+ this.initPBProject();
+ }
- private IProjectAdapter getProjectAdapter() {
- IProject project = this.getUnderlyingFile().getProject();
- IProjectAdapter projectAdapter = (IProjectAdapter) project.getAdapter(IProjectAdapter.class);
- return projectAdapter;
- }
+ public boolean isRebuildRequired() {
+ return rebuildRequired;
+ }
- private void initPBProject() {
- IProjectAdapter projectAdapter = this.getProjectAdapter();
- try {
- this.pbProject = new PBProject(this.getUnderlyingFile().getLocation().toOSString(), projectAdapter.isFramework());
- this.pbProject.update();
- IFile underlyingFile = getUnderlyingFile();
- if (!underlyingFile.exists()) {
- this.rebuildRequired = true;
- pbProject.saveChanges();
- try {
- underlyingFile.refreshLocal(IResource.DEPTH_ONE, null);
- }
- catch (CoreException e) {
- CorePlugin.getDefault().debug(this.getClass().getName() + "Error while refreshing PB.project: " + underlyingFile, e);
- }
- }
- addLocalFrameworkSectionToPBProject();
- syncProjectName();
- }
- catch (IOException e) {
- CorePlugin.getDefault().debug(this.getClass().getName() + "Error while loading PB.project: " + this.getUnderlyingFile(), e);
- }
- }
+ public void save(IProgressMonitor monitor) {
+ if (this.pbProject == null) {
+ return;
+ }
+ if (!this.saveRequired) {
+ return;
+ }
+ this.saveRequired = false;
+ this.pbProject.saveChanges();
+ try {
+ this.getUnderlyingFile()
+ .refreshLocal(IResource.DEPTH_ZERO, monitor);
+ } catch (CoreException up) {
+ CorePlugin.getDefault().debug(
+ this.getClass().getName()
+ + "Error while saving PB.project: "
+ + this.getUnderlyingFile(), up);
+ }
+ }
- public void cleanTables() {
- this.pbProject.setClasses(new ArrayList());
- this.pbProject.setWebServerResources(new ArrayList());
- this.pbProject.setWoAppResources(new ArrayList());
- this.pbProject.setWoComponents(new ArrayList());
- this.saveRequired = true;
- }
+ private IProjectAdapter getProjectAdapter() {
+ IProject project = this.getUnderlyingFile().getProject();
+ IProjectAdapter projectAdapter = (IProjectAdapter) project
+ .getAdapter(IProjectAdapter.class);
+ return projectAdapter;
+ }
- /**
- * Method syncProjectName.
- */
- public void syncProjectName() {
- String projectName = this.getUnderlyingResource().getProject().getName();
- if (!projectName.equals(this.pbProject.getProjectName())) {
- this.pbProject.setProjectName(projectName);
- this.saveRequired = true;
- }
- }
+ private void initPBProject() {
+ IProjectAdapter projectAdapter = this.getProjectAdapter();
+ try {
+ this.pbProject = new PBProject(this.getUnderlyingFile()
+ .getLocation().toOSString(), projectAdapter.isFramework());
+ this.pbProject.update();
+ IFile underlyingFile = getUnderlyingFile();
+ if (!underlyingFile.exists()) {
+ this.rebuildRequired = true;
+ pbProject.saveChanges();
+ try {
+ underlyingFile.refreshLocal(IResource.DEPTH_ONE, null);
+ } catch (CoreException e) {
+ CorePlugin.getDefault().debug(
+ this.getClass().getName()
+ + "Error while refreshing PB.project: "
+ + underlyingFile, e);
+ }
+ }
+ addLocalFrameworkSectionToPBProject();
+ syncProjectName();
+ } catch (IOException e) {
+ CorePlugin.getDefault().debug(
+ this.getClass().getName()
+ + "Error while loading PB.project: "
+ + this.getUnderlyingFile(), e);
+ }
+ }
- /**
- *
- */
- public void addLocalFrameworkSectionToPBProject() {
- List actualFrameworkSearch = this.pbProject.getFrameworkSearch();
- if (actualFrameworkSearch == null) {
- this.pbProject.setFrameworkSearch(new ArrayList());
- actualFrameworkSearch = this.pbProject.getFrameworkSearch();
- }
- if (!actualFrameworkSearch.contains(PBDotProjectAdapter.DefaultLocalFrameworkSearch)) {
- actualFrameworkSearch.add(PBDotProjectAdapter.DefaultLocalFrameworkSearch);
- }
- }
+ public void cleanTables() {
+ this.pbProject.setClasses(new ArrayList());
+ this.pbProject.setWebServerResources(new ArrayList());
+ this.pbProject.setWoAppResources(new ArrayList());
+ this.pbProject.setWoComponents(new ArrayList());
+ this.saveRequired = true;
+ }
- public void save() {
- if (this.pbProject != null && this.saveRequired) {
- this.pbProject.saveChanges();
- this.saveRequired = false;
- }
- }
+ /**
+ * Method syncProjectName.
+ */
+ public void syncProjectName() {
+ String projectName = this.getUnderlyingResource().getProject()
+ .getName();
+ if (!projectName.equals(this.pbProject.getProjectName())) {
+ this.pbProject.setProjectName(projectName);
+ this.saveRequired = true;
+ }
+ }
- private void addToListIfListNotContains(List list, Object object) {
- if (!list.contains(object)) {
- list.add(object);
- this.saveRequired = true;
- }
- }
+ /**
+ *
+ */
+ public void addLocalFrameworkSectionToPBProject() {
+ List actualFrameworkSearch = this.pbProject.getFrameworkSearch();
+ if (actualFrameworkSearch == null) {
+ this.pbProject.setFrameworkSearch(new ArrayList());
+ actualFrameworkSearch = this.pbProject.getFrameworkSearch();
+ }
+ if (!actualFrameworkSearch
+ .contains(PBDotProjectAdapter.DefaultLocalFrameworkSearch)) {
+ actualFrameworkSearch
+ .add(PBDotProjectAdapter.DefaultLocalFrameworkSearch);
+ }
+ }
- private void removeFromListIfListNotContains(List list, Object object) {
- if (list != null && list.contains(object)) {
- list.remove(object);
- this.saveRequired = true;
- }
- }
+ public void save() {
+ if (this.pbProject != null && this.saveRequired) {
+ this.pbProject.saveChanges();
+ this.saveRequired = false;
+ }
+ }
- public void addClass(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- List classes = this.pbProject.getClasses();
- if (classes == null) {
- this.pbProject.setClasses(new ArrayList());
- classes = this.pbProject.getClasses();
- }
- addToListIfListNotContains(classes, localizedPath.getResourcePath());
- }
+ private void addToListIfListNotContains(List list, Object object) {
+ if (!list.contains(object)) {
+ list.add(object);
+ this.saveRequired = true;
+ }
+ }
- public void removeClass(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- removeFromListIfListNotContains(this.pbProject.getClasses(), localizedPath.getResourcePath());
- }
+ private void removeFromListIfListNotContains(List list, Object object) {
+ if (list != null && list.contains(object)) {
+ list.remove(object);
+ this.saveRequired = true;
+ }
+ }
- public void addWoComponent(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- List woComponents = this.pbProject.getWoComponents(localizedPath.getLanguage());
- if (woComponents == null) {
- this.pbProject.setWoComponents(new ArrayList(), localizedPath.getLanguage());
- woComponents = this.pbProject.getWoComponents(localizedPath.getLanguage());
- }
- addToListIfListNotContains(woComponents, localizedPath.getResourcePath());
- }
+ public void addClass(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List classes = this.pbProject.getClasses();
+ if (classes == null) {
+ this.pbProject.setClasses(new ArrayList());
+ classes = this.pbProject.getClasses();
+ }
+ addToListIfListNotContains(classes, localizedPath.getResourcePath());
+ }
- public void removeWoComponent(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- removeFromListIfListNotContains(this.pbProject.getWoComponents(localizedPath.getLanguage()), localizedPath.getResourcePath());
- }
+ public void removeClass(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ removeFromListIfListNotContains(this.pbProject.getClasses(),
+ localizedPath.getResourcePath());
+ }
- public void addWoappResource(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- List woAppResourcesComponents = this.pbProject.getWoAppResources(localizedPath.getLanguage());
- if (woAppResourcesComponents == null) {
- this.pbProject.setWoAppResources(new ArrayList(), localizedPath.getLanguage());
- woAppResourcesComponents = this.pbProject.getWoAppResources(localizedPath.getLanguage());
- }
- addToListIfListNotContains(woAppResourcesComponents, localizedPath.getResourcePath());
- }
+ public void addWoComponent(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List woComponents = this.pbProject.getWoComponents(localizedPath
+ .getLanguage());
+ if (woComponents == null) {
+ this.pbProject.setWoComponents(new ArrayList(), localizedPath
+ .getLanguage());
+ woComponents = this.pbProject.getWoComponents(localizedPath
+ .getLanguage());
+ }
+ addToListIfListNotContains(woComponents, localizedPath
+ .getResourcePath());
+ }
- public void removeWoappResource(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- removeFromListIfListNotContains(this.pbProject.getWoAppResources(localizedPath.getLanguage()), localizedPath.getResourcePath());
- }
+ public void removeWoComponent(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ removeFromListIfListNotContains(this.pbProject
+ .getWoComponents(localizedPath.getLanguage()), localizedPath
+ .getResourcePath());
+ }
- public void addWebServerResource(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- List wsResourcesComponents = this.pbProject.getWebServerResources(localizedPath.getLanguage());
- if (wsResourcesComponents == null) {
- this.pbProject.setWebServerResources(new ArrayList(), localizedPath.getLanguage());
- wsResourcesComponents = this.pbProject.getWebServerResources(localizedPath.getLanguage());
- }
- addToListIfListNotContains(wsResourcesComponents, localizedPath.getResourcePath());
- }
+ public void addWoappResource(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List woAppResourcesComponents = this.pbProject
+ .getWoAppResources(localizedPath.getLanguage());
+ if (woAppResourcesComponents == null) {
+ this.pbProject.setWoAppResources(new ArrayList(), localizedPath
+ .getLanguage());
+ woAppResourcesComponents = this.pbProject
+ .getWoAppResources(localizedPath.getLanguage());
+ }
+ addToListIfListNotContains(woAppResourcesComponents, localizedPath
+ .getResourcePath());
+ }
- public void removeWebServerResource(ILocalizedPath localizedPath) {
- if (this.pbProject == null) {
- return;
- }
- removeFromListIfListNotContains(this.pbProject.getWebServerResources(localizedPath.getLanguage()), localizedPath.getResourcePath());
- }
+ public void removeWoappResource(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ removeFromListIfListNotContains(this.pbProject
+ .getWoAppResources(localizedPath.getLanguage()), localizedPath
+ .getResourcePath());
+ }
- public void updateFrameworkNames(List frameworkNames) {
- if (this.pbProject == null) {
- return;
- }
- List list = pbProject.getFrameworks();
- boolean set = false;
- int existingNamesLength = list.size();
- int newNamesLength = frameworkNames.size();
- if (existingNamesLength != newNamesLength) {
- set = true;
- }
- else {
- for (int i = 0; i < newNamesLength; i++) {
- String currentName = (String) frameworkNames.get(i);
- if (!list.contains(currentName)) {
- set = true;
- break;
- }
- }
- }
- if (set) {
- pbProject.setFrameworks(frameworkNames);
- this.saveRequired = true;
- }
- }
+ public void addWebServerResource(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List wsResourcesComponents = this.pbProject
+ .getWebServerResources(localizedPath.getLanguage());
+ if (wsResourcesComponents == null) {
+ this.pbProject.setWebServerResources(new ArrayList(), localizedPath
+ .getLanguage());
+ wsResourcesComponents = this.pbProject
+ .getWebServerResources(localizedPath.getLanguage());
+ }
+ addToListIfListNotContains(wsResourcesComponents, localizedPath
+ .getResourcePath());
+ }
+
+ public void removeWebServerResource(ILocalizedPath localizedPath) {
+ if (this.pbProject == null) {
+ return;
+ }
+ removeFromListIfListNotContains(this.pbProject
+ .getWebServerResources(localizedPath.getLanguage()),
+ localizedPath.getResourcePath());
+ }
+
+ public void updateFrameworkNames(List frameworkNames) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List list = pbProject.getFrameworks();
+ boolean set = false;
+ int existingNamesLength = list.size();
+ int newNamesLength = frameworkNames.size();
+ if (existingNamesLength != newNamesLength) {
+ set = true;
+ } else {
+ for (int i = 0; i < newNamesLength; i++) {
+ String currentName = (String) frameworkNames.get(i);
+ if (!list.contains(currentName)) {
+ set = true;
+ break;
+ }
+ }
+ }
+ if (set) {
+ pbProject.setFrameworks(frameworkNames);
+ this.saveRequired = true;
+ }
+ }
+
+ public void addSubproject(IDotSubprojAdapter dotSubprojAdapter) {
+ if (this.pbProject == null) {
+ return;
+ }
+ List subProjects = this.pbProject.getSubprojects();
+ if (subProjects == null) {
+ this.pbProject.setSubprojects(new ArrayList());
+ subProjects = this.pbProject.getSubprojects();
+ }
+ addToListIfListNotContains(subProjects, dotSubprojAdapter
+ .getSubprojectName());
+ }
+
+ public void removeSubproject(IDotSubprojAdapter dotSubprojAdapter) {
+ if (this.pbProject == null) {
+ return;
+ }
+ removeFromListIfListNotContains(this.pbProject.getSubprojects(),
+ dotSubprojAdapter.getSubprojectName());
+
+ }
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642