From 433600ba7b192fdf51133da565380de79f119f32 Mon Sep 17 00:00:00 2001 From: axelcl Date: Sun, 2 Jan 2005 15:18:32 +0000 Subject: [PATCH] made message: "Include filename doesn't exist in project" configurable through preferences (i.e. error, warning, ignore) --- net.sourceforge.phpeclipse/plugin.xml | 2 +- .../src/net/sourceforge/phpdt/core/JavaCore.java | 25 ++++++------------- .../sourceforge/phpdt/core/compiler/IProblem.java | 1 + .../internal/compiler/impl/CompilerOptions.java | 9 ++++++- .../phpdt/internal/compiler/parser/Parser.java | 12 +++++---- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/net.sourceforge.phpeclipse/plugin.xml b/net.sourceforge.phpeclipse/plugin.xml index e72b1bd..63cea1a 100644 --- a/net.sourceforge.phpeclipse/plugin.xml +++ b/net.sourceforge.phpeclipse/plugin.xml @@ -1034,7 +1034,7 @@ label="Insert HTML (dl,ul,ol,table)" class="net.sourceforge.phpeclipse.wizards.html.InsertHTMLElementAction" menubarPath="additions" - id="net.sourceforge.phpdt.phphelp.actions.contexthelp"> + id="net.sourceforge.phpeclipse.actions.wizards.html"> diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java index e16da97..5dd77a1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java @@ -9,7 +9,7 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; -import net.sourceforge.phpdt.internal.core.BatchOperation; +import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions; import net.sourceforge.phpdt.internal.core.BufferManager; import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; @@ -25,25 +25,15 @@ import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ISavedState; -import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.Job; -import net.sourceforge.phpdt.internal.core.util.Util; -import org.osgi.framework.BundleContext; public class JavaCore { @@ -295,14 +285,13 @@ public class JavaCore { * * @see #getDefaultOptions */ - public static final String COMPILER_PB_PHP_VAR_DEPRECATED = PLUGIN_ID - + ".compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$ + public static final String COMPILER_PB_PHP_VAR_DEPRECATED = CompilerOptions.OPTION_PHPVarDeprecatedWarning; //$NON-NLS-1$ - public static final String COMPILER_PB_PHP_KEYWORD = PLUGIN_ID - + ".compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$ + public static final String COMPILER_PB_PHP_KEYWORD = CompilerOptions.OPTION_PHPBadStyleKeywordWarning; //$NON-NLS-1$ - public static final String COMPILER_PB_PHP_UPPERCASE_IDENTIFIER = PLUGIN_ID - + ".compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$ + public static final String COMPILER_PB_PHP_UPPERCASE_IDENTIFIER = CompilerOptions.OPTION_PHPBadStyleUppercaseIdentifierWarning; //$NON-NLS-1$ + + public static final String COMPILER_PB_PHP_FILE_NOT_EXIST = CompilerOptions.OPTION_PHPIncludeNotExistWarning; //$NON-NLS-1$ /** * Possible configurable option ID. @@ -2914,6 +2903,8 @@ public class JavaCore { optionNames.add(COMPILER_PB_PHP_KEYWORD); preferences.setDefault(COMPILER_PB_PHP_UPPERCASE_IDENTIFIER, IGNORE); optionNames.add(COMPILER_PB_PHP_UPPERCASE_IDENTIFIER); + preferences.setDefault(COMPILER_PB_PHP_FILE_NOT_EXIST, WARNING); + optionNames.add(COMPILER_PB_PHP_FILE_NOT_EXIST); preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); optionNames.add(COMPILER_PB_UNREACHABLE_CODE); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java index d8be369..b143082 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java @@ -369,6 +369,7 @@ public interface IProblem { int PHPVarDeprecatedWarning = Syntax + Internal + 213; int PHPBadStyleKeywordWarning = Syntax + Internal + 214; int PHPBadStyleUppercaseIdentifierWarning = Syntax + Internal + 215; + int PHPIncludeNotExistWarning = Syntax + Internal + 216; int UnmatchedBracket = Syntax + Internal + 220; int NoFieldOnBaseType = FieldRelated + 221; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java index 9149e3b..b369369 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java @@ -30,6 +30,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons public static final String OPTION_PHPVarDeprecatedWarning = "net.sourceforge.phpeclipse.compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$ public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$ public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$ + public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$ + public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$ public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$ public static final String OPTION_SourceFileAttribute = "net.sourceforge.phpeclipse.compiler.debug.sourceFile"; //$NON-NLS-1$ @@ -149,9 +151,11 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons public static final long MissingJavadocTags = 0x8000000000L; public static final long MissingJavadocComments = 0x10000000000L; + public static final long PHPVarDeprecatedWarning = 0x20000000000L; public static final long PHPBadStyleKeywordWarning = 0x40000000000L; public static final long PHPBadStyleUppercaseIdentifierWarning = 0x80000000000L; + public static final long PHPIncludeNotExistWarning = 0x100000000000L; // Default severity level for handlers public long errorThreshold = 0; @@ -169,7 +173,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons | AssertUsedAsAnIdentifier | PHPVarDeprecatedWarning | PHPBadStyleKeywordWarning - | PHPBadStyleUppercaseIdentifierWarning; + | PHPBadStyleUppercaseIdentifierWarning + | PHPIncludeNotExistWarning; // Debug attributes public static final int Source = 1; // SourceFileAttribute @@ -482,6 +487,7 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons if ((optionValue = optionsMap.get(OPTION_PHPVarDeprecatedWarning)) != null) updateSeverity(PHPVarDeprecatedWarning, optionValue); if ((optionValue = optionsMap.get(OPTION_PHPBadStyleKeywordWarning)) != null) updateSeverity(PHPBadStyleKeywordWarning, optionValue); if ((optionValue = optionsMap.get(OPTION_PHPBadStyleUppercaseIdentifierWarning)) != null) updateSeverity(PHPBadStyleUppercaseIdentifierWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_PHPIncludeNotExistWarning)) != null) updateSeverity(PHPIncludeNotExistWarning, optionValue); if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue); if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue); @@ -585,6 +591,7 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons buf.append("\n\t- var is deprecated keyword: ").append(getSeverityString(PHPVarDeprecatedWarning)); //$NON-NLS-1$ buf.append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$ buf.append("\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$ + buf.append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$ buf.append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buf.append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 73d504e..dfb95ea 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -1,6 +1,6 @@ /*********************************************************************************************************************************** - * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are - * made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at + * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are made available under the + * terms of the Common Public License v1.0 which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: www.phpeclipse.de @@ -3397,9 +3397,11 @@ public class Parser //extends PHPParserSuperclass IProject project = resource.getProject(); if (project != null) { if (PHPFileUtil.determineFilePath(includeNameString, resource, project) == null) { - reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: " - + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd); - // System.out.println(path.toString() + " - " + expression.toStringExpression()); + // reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: " + // + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd); + String[] args = { expression.toStringExpression(), project.getLocation().toString() }; + problemReporter.phpIncludeNotExistWarning(args, literal.sourceStart, literal.sourceEnd, referenceContext, + compilationUnit.compilationResult); } } } -- 1.7.1