Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
189 additions
and
93 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
...ore/src/com/liferay/ide/eclipse/core/model/internal/GenericResourceBundlePathService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.core.model.internal; | ||
|
||
import com.liferay.ide.eclipse.core.util.CoreUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.resources.IWorkspaceRoot; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.jdt.core.IClasspathEntry; | ||
import org.eclipse.sapphire.modeling.Path; | ||
import org.eclipse.sapphire.services.RelativePathService; | ||
|
||
/** | ||
* @author Kamesh Sampath | ||
*/ | ||
public abstract class GenericResourceBundlePathService extends RelativePathService | ||
{ | ||
|
||
public static final String RB_FILE_EXTENSION = "properties"; | ||
final IWorkspaceRoot WORKSPACE_ROOT = CoreUtil.getWorkspaceRoot(); | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see org.eclipse.sapphire.services.RelativePathService#roots() | ||
*/ | ||
@Override | ||
public final List<Path> roots() | ||
{ | ||
IProject project = project(); | ||
List<Path> roots = computeRoots( project ); | ||
return roots; | ||
} | ||
|
||
/** | ||
* This method is used to get the IProject handle of the project relative to which the source paths needs to be | ||
* computed | ||
* | ||
* @return handle to IProject | ||
*/ | ||
protected abstract IProject project(); | ||
|
||
/** | ||
* @param project | ||
* @return | ||
*/ | ||
final List<Path> computeRoots( IProject project ) | ||
{ | ||
List<Path> roots = new ArrayList<Path>(); | ||
if( project != null ) | ||
{ | ||
IClasspathEntry[] cpEntries = CoreUtil.getClasspathEntries( project ); | ||
for( IClasspathEntry iClasspathEntry : cpEntries ) | ||
{ | ||
if( IClasspathEntry.CPE_SOURCE == iClasspathEntry.getEntryKind() ) | ||
{ | ||
IPath entryPath = WORKSPACE_ROOT.getFolder( iClasspathEntry.getPath() ).getLocation(); | ||
String fullPath = entryPath.toOSString(); | ||
Path sapphirePath = new Path( fullPath ); | ||
roots.add( sapphirePath ); | ||
} | ||
} | ||
|
||
} | ||
return roots; | ||
} | ||
|
||
@Override | ||
public final Path convertToAbsolute( Path path ) | ||
{ | ||
Path absPath = path.addFileExtension( RB_FILE_EXTENSION ); | ||
return absPath; | ||
} | ||
|
||
} |
79 changes: 0 additions & 79 deletions
79
...re/src/com/liferay/ide/eclipse/core/model/internal/ResourceBundleRelativePathService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...c/com/liferay/ide/eclipse/hook/core/model/internal/ResourceBundleRelativePathService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* Contributors: | ||
* Kamesh Sampath initial implementation | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.hook.core.model.internal; | ||
|
||
import com.liferay.ide.eclipse.core.model.internal.GenericResourceBundlePathService; | ||
import com.liferay.ide.eclipse.hook.core.model.IHook; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
|
||
/** | ||
* @author Kamesh Sampath | ||
*/ | ||
public class ResourceBundleRelativePathService extends GenericResourceBundlePathService | ||
{ | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see com.liferay.ide.eclipse.core.model.internal.GenericResourceBundlePathService#project() | ||
*/ | ||
@Override | ||
protected IProject project() | ||
{ | ||
final IProject project = context().find( IHook.class ).adapt( IProject.class ); | ||
return project; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...om/liferay/ide/eclipse/portlet/core/model/internal/ResourceBundleRelativePathService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* Contributors: | ||
* Kamesh Sampath initial implementation | ||
*******************************************************************************/ | ||
|
||
package com.liferay.ide.eclipse.portlet.core.model.internal; | ||
|
||
import com.liferay.ide.eclipse.core.model.internal.GenericResourceBundlePathService; | ||
import com.liferay.ide.eclipse.portlet.core.model.IPortletApp; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
|
||
/** | ||
* @author Kamesh Sampath | ||
*/ | ||
public class ResourceBundleRelativePathService extends GenericResourceBundlePathService | ||
{ | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see com.liferay.ide.eclipse.core.model.internal.GenericResourceBundlePathService#project() | ||
*/ | ||
@Override | ||
protected IProject project() | ||
{ | ||
final IProject project = context().find( IPortletApp.class ).adapt( IProject.class ); | ||
return project; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters