Skip to content

Commit

Permalink
IDE-662 - for Greg's Review
Browse files Browse the repository at this point in the history
fixed copyrights
  • Loading branch information
kameshsampath committed Jul 23, 2012
1 parent 8c32d1e commit 24c63b8
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 93 deletions.
@@ -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;
}

}

This file was deleted.

Expand Up @@ -18,7 +18,7 @@

package com.liferay.ide.eclipse.hook.core.model;

import com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.hook.core.model.internal.ResourceBundleRelativePathService;

import org.eclipse.sapphire.modeling.IModelElement;
import org.eclipse.sapphire.modeling.ModelElementType;
Expand All @@ -34,7 +34,7 @@
import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding;

/**
* @author <a href="mailto:kamesh.sampath@hotmail.com">Kamesh Sampath</a>
* @author Kamesh Sampath
*/
@GenerateImpl
@Image( path = "images/elcl16/locale_16x16.gif" )
Expand Down
@@ -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;
}

}
Expand Up @@ -17,7 +17,7 @@

package com.liferay.ide.eclipse.portlet.core.model;

import com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleValueBinding;

import org.eclipse.sapphire.modeling.IModelElement;
Expand Down Expand Up @@ -48,7 +48,7 @@ public interface IResourceBundle extends IModelElement {

// *** ResourceBundle ***
@Type( base = Path.class )
@Services( value = { @Service( impl = ResourceBundleRelativePathService.class ) } )
@Services( value = { @Service( impl = ResourceBundleRelativePathService.class ) } )
@FileExtensions( expr = "properties" )
@ValidFileSystemResourceType( FileSystemResourceType.FILE )
@XmlBinding( path = "resource-bundle" )
Expand Down
Expand Up @@ -17,7 +17,7 @@

package com.liferay.ide.eclipse.portlet.core.model.internal;

import static com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService.RB_FILE_EXTENSION;
import static com.liferay.ide.eclipse.core.model.internal.GenericResourceBundlePathService.RB_FILE_EXTENSION;

import com.liferay.ide.eclipse.core.util.CoreUtil;
import com.liferay.ide.eclipse.portlet.core.model.IPortlet;
Expand All @@ -43,7 +43,7 @@
import org.eclipse.sapphire.services.ValidationService;

/**
* @author <a href="mailto:kamesh.sampath@accenture.com">Kamesh Sampath</a>
* @author Kamesh Sampath
*/
public class LocaleBundleValidationService extends ValidationService {

Expand Down
@@ -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;
}

}
Expand Up @@ -17,8 +17,8 @@

package com.liferay.ide.eclipse.portlet.ui.editor.internal;

import com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.core.util.CoreUtil;
import com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.util.PortletUtil;
import com.liferay.ide.eclipse.portlet.ui.PortletUIPlugin;

Expand Down Expand Up @@ -51,7 +51,7 @@
import org.eclipse.sapphire.ui.SapphireRenderingContext;

/**
* @author <a href="mailto:kamesh.sampath@accenture.com">Kamesh Sampath</a>
* @author Kamesh Sampath
*/
public abstract class AbstractResourceBundleActionHandler extends SapphirePropertyEditorActionHandler {

Expand Down
Expand Up @@ -18,8 +18,8 @@

package com.liferay.ide.eclipse.portlet.ui.editor.internal;

import com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.model.IPortletApp;
import com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.util.PortletUtil;

import java.util.ArrayList;
Expand All @@ -44,7 +44,7 @@
import org.eclipse.sapphire.ui.def.ActionHandlerDef;

/**
* @author <a href="mailto:kamesh.sampath@accenture.com">Kamesh Sampath</a>
* @author Kamesh Sampath
* @author Gregory Amerson
*/
public class CreatePortletAppResourceBundleActionHandler extends AbstractResourceBundleActionHandler {
Expand Down
Expand Up @@ -18,10 +18,10 @@

package com.liferay.ide.eclipse.portlet.ui.editor.internal;

import com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.model.IPortlet;
import com.liferay.ide.eclipse.portlet.core.model.IPortletInfo;
import com.liferay.ide.eclipse.portlet.core.model.ISupportedLocales;
import com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleRelativePathService;
import com.liferay.ide.eclipse.portlet.core.util.PortletUtil;

import java.util.ArrayList;
Expand All @@ -44,7 +44,7 @@
import org.eclipse.sapphire.ui.def.ActionHandlerDef;

/**
* @author <a href="mailto:kamesh.sampath@accenture.com">Kamesh Sampath</a>
* @author Kamesh Sampath
* @author Gregory Amerson
*/
public class CreatePortletResourceBundleActionHandler extends AbstractResourceBundleActionHandler {
Expand Down
Expand Up @@ -17,7 +17,7 @@

package com.liferay.ide.eclipse.portlet.ui.editor.internal;

import static com.liferay.ide.eclipse.core.model.internal.ResourceBundleRelativePathService.RB_FILE_EXTENSION;
import static com.liferay.ide.eclipse.portlet.core.model.internal.ResourceBundleRelativePathService.RB_FILE_EXTENSION;

import com.liferay.ide.eclipse.core.util.CoreUtil;
import com.liferay.ide.eclipse.portlet.core.util.PortletUtil;
Expand All @@ -44,7 +44,7 @@
import org.eclipse.ui.ide.IDE;

/**
* @author <a href="mailto:kamesh.sampath@accenture.com">Kamesh Sampath</a>
* @author Kamesh Sampath
*/
public class ResourceBundleJumpActionHandler extends SapphireJumpActionHandler {

Expand Down

0 comments on commit 24c63b8

Please sign in to comment.