preprocessedsourcemapper.java
来自「配置文件」· Java 代码 · 共 67 行
JAVA
67 行
/**
* Copyright (c) 2003-2007 Craig Setera
* All Rights Reserved.
* Licensed under the Eclipse Public License - v 1.0
* For more information see http://www.eclipse.org/legal/epl-v10.html
*/
package eclipseme.core.internal.preprocessor;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import eclipseme.core.IEclipseMECoreConstants;
import eclipseme.core.hook.sourceMapper.SourceMapper;
import eclipseme.core.internal.EclipseMECorePlugin;
/**
* An implementation of the {@link SourceMapper} hook interface. This
* mapper attempts to map the requested file to a preprocessed version
* of the file.
* <p />
* Copyright (c) 2003-2007 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.1 $
* <br>
* $Date: 2007/01/20 19:22:58 $
* <br>
* @author Craig Setera
*/
public class PreprocessedSourceMapper implements SourceMapper {
public IFile getMappedResource(IFile sourceFile) {
IFile mappedFile = null;
if (isPreprocessingProject(sourceFile.getProject())) {
mappedFile = PreprocessorBuilder.getOutputFile(sourceFile);
if (!mappedFile.exists()) {
mappedFile = null;
}
}
return mappedFile;
}
/**
* Return a boolean indicating whether the specified project has
* preprocessing enabled.
*
* @param project
* @return
*/
private boolean isPreprocessingProject(IProject project) {
boolean preprocessing = false;
try {
preprocessing =
project.hasNature(IEclipseMECoreConstants.J2ME_PREPROCESSING_NATURE_ID);
} catch (CoreException e) {
EclipseMECorePlugin.log(IStatus.WARNING, e);
}
return preprocessing;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?