📄 preprocessedsourcemapper.java
字号:
/**
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -