From 18961f52fce4f3a3e0469f0d62cc642b0dbbccff Mon Sep 17 00:00:00 2001
From: axelcl
* Note that a package fragment root is returned rather than a default package.
@@ -325,7 +330,7 @@ public class JavaModelManager implements ISaveParticipant {
}
IJavaElement element = determineIfOnClasspath(folder, project);
if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project)
- || (folder.getName().indexOf('.') >= 0
+ || (folder.getName().indexOf('.') >= 0
&& !(element instanceof IPackageFragmentRoot))) {
return null; // only package fragment roots are allowed with dot names
} else {
@@ -354,9 +359,9 @@ public class JavaModelManager implements ISaveParticipant {
// }
// return pkg.getClassFile(file.getName());
// }
-
+
/**
- * Creates and returns a compilation unit element for the given
* Clients are not allowed to call this method if the old setup with text tools is in use.
*
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* Value is of type
* This will force a rebuild of the descriptors the next time a client asks for them.
*
* If this method is called in the dynamic scope of another such call, this method simply runs the action.
* JavaModelManager
is available from
* the static method JavaModelManager.getJavaModelManager()
.
*/
-public class JavaModelManager implements ISaveParticipant {
+public class JavaModelManager implements ISaveParticipant {
/**
* Unique handle onto the JavaModel
*/
@@ -97,7 +97,7 @@ public class JavaModelManager implements ISaveParticipant {
public final static String CP_VARIABLE_PREFERENCES_PREFIX = PHPeclipsePlugin.PLUGIN_ID+".classpathVariable."; //$NON-NLS-1$
public final static String CP_CONTAINER_PREFERENCES_PREFIX = PHPeclipsePlugin.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$
public final static String CP_ENTRY_IGNORE = "##null
if unable to associate the given folder with a Java element.
* .java
+ * Creates and returns a compilation unit element for the given .java
* file, its project being the given project. Returns null
if unable
* to recognize the compilation unit.
*/
@@ -372,7 +377,7 @@ public class JavaModelManager implements ISaveParticipant {
// not on classpath - make the root its folder, and a default package
IPackageFragmentRoot root = project.getPackageFragmentRoot(file.getParent());
pkg = root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
-
+
if (VERBOSE){
System.out.println("WARNING : creating unit element outside classpath ("+ Thread.currentThread()+"): " + file.getFullPath()); //$NON-NLS-1$//$NON-NLS-2$
}
@@ -382,7 +387,7 @@ public class JavaModelManager implements ISaveParticipant {
/**
* Creates and returns a handle for the given JAR file, its project being the given project.
* The Java model associated with the JAR's project may be
- * created as a side effect.
+ * created as a side effect.
* Returns null
if unable to create a JAR package fragment root.
* (for example, if the JAR file represents a non-Java resource)
*/
@@ -393,7 +398,7 @@ public class JavaModelManager implements ISaveParticipant {
// if (project == null) {
// project = PHPCore.create(file.getProject());
// }
-//
+//
// // Create a jar package fragment root only if on the classpath
// IPath resourcePath = file.getFullPath();
// try {
@@ -409,7 +414,7 @@ public class JavaModelManager implements ISaveParticipant {
// }
// return null;
// }
-
+
/**
* Returns the package fragment root represented by the resource, or
* the package fragment the given resource is located in, or null
@@ -418,20 +423,20 @@ public class JavaModelManager implements ISaveParticipant {
public static IJavaElement determineIfOnClasspath(
IResource resource,
IJavaProject project) {
-
+
IPath resourcePath = resource.getFullPath();
try {
- IClasspathEntry[] entries =
+ IClasspathEntry[] entries =
net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(resourcePath.lastSegment())
? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path)
: ((JavaProject)project).getResolvedClasspath(true);
-
+
for (int i = 0; i < entries.length; i++) {
IClasspathEntry entry = entries[i];
if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) continue;
IPath rootPath = entry.getPath();
if (rootPath.equals(resourcePath)) {
- return project.getPackageFragmentRoot(resource);
+ return project.getPackageFragmentRoot(resource);
} else if (rootPath.isPrefixOf(resourcePath) && !Util.isExcluded(resource, null, ((ClasspathEntry)entry).fullExclusionPatternChars())) {
// given we have a resource child of the root, it cannot be a JAR pkg root
IPackageFragmentRoot root = ((JavaProject) project).getFolderPackageFragmentRoot(rootPath);
@@ -441,7 +446,7 @@ public class JavaModelManager implements ISaveParticipant {
// if the resource is a file, then remove the last segment which
// is the file name in the package
pkgPath = pkgPath.removeLastSegments(1);
-
+
// don't check validity of package name (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=26706)
// String pkgName = pkgPath.toString().replace('/', '.');
String pkgName = pkgPath.toString();
@@ -460,7 +465,7 @@ public class JavaModelManager implements ISaveParticipant {
}
return null;
}
-
+
/**
* The singleton manager
*/
@@ -520,7 +525,7 @@ public class JavaModelManager implements ISaveParticipant {
*/
private final ModelUpdater modelUpdater =new ModelUpdater();
/**
- * Workaround for bug 15168 circular errors not reported
+ * Workaround for bug 15168 circular errors not reported
* This is a cache of the projects before any project addition/deletion has started.
*/
public IJavaProject[] javaProjectsCache;
@@ -530,13 +535,13 @@ public class JavaModelManager implements ISaveParticipant {
* NOTE: this object itself is used as a lock to synchronize creation/removal of per project infos
*/
protected Map perProjectInfo = new HashMap(5);
-
+
/**
* A map from ICompilationUnit to IWorkingCopy
* of the shared working copies.
*/
public Map sharedWorkingCopies = new HashMap();
-
+
/**
* A weak set of the known scopes.
*/
@@ -558,9 +563,9 @@ public class JavaModelManager implements ISaveParticipant {
// this.project = project;
// }
// }
-
+
public static class PerProjectInfo {
-
+
public IProject project;
public Object savedState;
public boolean triedRead;
@@ -569,14 +574,14 @@ public class JavaModelManager implements ISaveParticipant {
public Map resolvedPathToRawEntries; // reverse map from resolved path to raw entries
public IPath outputLocation;
public Preferences preferences;
-
+
public PerProjectInfo(IProject project) {
this.triedRead = false;
this.savedState = null;
this.project = project;
}
-
+
// updating raw classpath need to flush obsoleted cached information about resolved entries
public synchronized void updateClasspathInformation(IClasspathEntry[] newRawClasspath) {
@@ -618,7 +623,7 @@ public class JavaModelManager implements ISaveParticipant {
return buffer.toString();
}
}
-
+
public static class PerWorkingCopyInfo implements IProblemRequestor {
int useCount = 0;
IProblemRequestor problemRequestor;
@@ -659,15 +664,15 @@ public class JavaModelManager implements ISaveParticipant {
public static boolean VERBOSE = false;
public static boolean CP_RESOLVE_VERBOSE = false;
public static boolean ZIP_ACCESS_VERBOSE = false;
-
+
/**
* A cache of opened zip files per thread.
* (map from Thread to map of IPath to java.io.ZipFile)
* NOTE: this object itself is used as a lock to synchronize creation/removal of entries
*/
private HashMap zipFiles = new HashMap();
-
-
+
+
/**
* Update the classpath variable cache
*/
@@ -717,7 +722,7 @@ public class JavaModelManager implements ISaveParticipant {
public void addElementChangedListener(IElementChangedListener listener, int eventMask) {
for (int i = 0; i < this.elementChangedListenerCount; i++){
if (this.elementChangedListeners[i].equals(listener)){
-
+
// only clone the masks, since we could be in the middle of notifications and one listener decide to change
// any event mask of another listeners (yet not notified).
int cloneLength = this.elementChangedListenerMasks.length;
@@ -763,7 +768,7 @@ public class JavaModelManager implements ISaveParticipant {
}
}
}
-
+
/**
@@ -772,16 +777,16 @@ public class JavaModelManager implements ISaveParticipant {
public void configurePluginDebugOptions(){
if(JavaCore.getPlugin().isDebugging()){
// TODO jsurfer temp-del
-
+
String option = Platform.getDebugOption(BUILDER_DEBUG);
// if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
-//
+//
// option = Platform.getDebugOption(COMPILER_DEBUG);
// if(option != null) Compiler.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
//
// option = Platform.getDebugOption(COMPLETION_DEBUG);
// if(option != null) CompletionEngine.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
-//
+//
option = Platform.getDebugOption(CP_RESOLVE_DEBUG);
if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
@@ -793,7 +798,7 @@ public class JavaModelManager implements ISaveParticipant {
//
// option = Platform.getDebugOption(INDEX_MANAGER_DEBUG);
// if(option != null) IndexManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
-
+
option = Platform.getDebugOption(JAVAMODEL_DEBUG);
if(option != null) JavaModelManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
@@ -810,7 +815,7 @@ public class JavaModelManager implements ISaveParticipant {
if(option != null) JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
}
}
-
+
/*
* Discards the per working copy info for the given working copy (making it a compilation unit)
@@ -827,10 +832,10 @@ public class JavaModelManager implements ISaveParticipant {
WorkingCopyOwner owner = workingCopy.owner;
Map workingCopyToInfos = (Map)this.perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null) return -1;
-
+
PerWorkingCopyInfo info = (PerWorkingCopyInfo)workingCopyToInfos.get(workingCopy);
if (info == null) return -1;
-
+
if (--info.useCount == 0) {
// create the delta builder (this remembers the current content of the working copy)
JavaElementDeltaBuilder deltaBuilder = null;
@@ -855,26 +860,26 @@ public class JavaModelManager implements ISaveParticipant {
getDeltaProcessor().registerJavaModelDelta(deltaBuilder.delta);
}
}
-
+
}
return info.useCount;
}
}
-
+
/**
* @see ISaveParticipant
*/
public void doneSaving(ISaveContext context){
}
-
+
/**
* Fire Java Model delta, flushing them after the fact after post_change notification.
- * If the firing mode has been turned off, this has no effect.
+ * If the firing mode has been turned off, this has no effect.
*/
public void fire(IJavaElementDelta customDelta, int eventType) {
if (!this.isFiring) return;
-
+
if (DeltaProcessor.VERBOSE && (eventType == DEFAULT_CHANGE_EVENT || eventType == ElementChangedEvent.PRE_AUTO_BUILD)) {
System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$
}
@@ -885,7 +890,7 @@ public class JavaModelManager implements ISaveParticipant {
} else {
deltaToNotify = customDelta;
}
-
+
// Refresh internal scopes
if (deltaToNotify != null) {
// TODO temp-del
@@ -895,9 +900,9 @@ public class JavaModelManager implements ISaveParticipant {
// scope.processDelta(deltaToNotify);
// }
}
-
+
// Notification
-
+
// Important: if any listener reacts to notification by updating the listeners list or mask, these lists will
// be duplicated, so it is necessary to remember original lists in a variable (since field values may change under us)
IElementChangedListener[] listeners = this.elementChangedListeners;
@@ -926,7 +931,7 @@ public class JavaModelManager implements ISaveParticipant {
IElementChangedListener[] listeners,
int[] listenerMask,
int listenerCount) {
-
+
if (DeltaProcessor.VERBOSE){
System.out.println("FIRING PRE_AUTO_BUILD Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$
System.out.println(deltaToNotify == null ? "IJavaElement
represented by the
+ * Returns the IJavaElement
represented by the
* String
memento.
*/
public IJavaElement getHandleFromMemento(String memento) throws JavaModelException {
@@ -1155,8 +1160,8 @@ public class JavaModelManager implements ISaveParticipant {
}
return info;
}
- }
-
+ }
+
/*
* Returns the per-project info for the given project.
* If the info doesn't exist, check for the project existence and create the info.
@@ -1195,12 +1200,12 @@ public class JavaModelManager implements ISaveParticipant {
if (info != null && recordUsage) info.useCount++;
return info;
}
- }
+ }
/**
* Returns the name of the variables for which an CP variable initializer is registered through an extension point
*/
public static String[] getRegisteredVariableNames(){
-
+
Plugin jdtCorePlugin = JavaCore.getPlugin();
if (jdtCorePlugin == null) return null;
@@ -1214,18 +1219,18 @@ public class JavaModelManager implements ISaveParticipant {
// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
// if (varAttribute != null) variableList.add(varAttribute);
// }
-// }
+// }
// }
String[] variableNames = new String[variableList.size()];
variableList.toArray(variableNames);
return variableNames;
- }
+ }
/**
* Returns the name of the container IDs for which an CP container initializer is registered through an extension point
*/
// public static String[] getRegisteredContainerIDs(){
-//
+//
// Plugin jdtCorePlugin = PHPCore.getPlugin();
// if (jdtCorePlugin == null) return null;
//
@@ -1239,12 +1244,12 @@ public class JavaModelManager implements ISaveParticipant {
// String idAttribute = configElements[j].getAttribute("id"); //$NON-NLS-1$
// if (idAttribute != null) containerIDList.add(idAttribute);
// }
-// }
+// }
// }
// String[] containerIDs = new String[containerIDList.size()];
// containerIDList.toArray(containerIDs);
// return containerIDs;
-// }
+// }
/**
* Returns the File to use for saving and restoring the last built state for the given project.
@@ -1254,7 +1259,7 @@ public class JavaModelManager implements ISaveParticipant {
IPath workingLocation = project.getWorkingLocation(JavaCore.PLUGIN_ID);
return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$
}
-
+
/*
* Returns the temporary cache for newly opened elements for the current thread.
* Creates it if not already created.
@@ -1275,14 +1280,14 @@ public class JavaModelManager implements ISaveParticipant {
* @exception CoreException If unable to create/open the ZipFile
*/
public ZipFile getZipFile(IPath path) throws CoreException {
-
+
synchronized(this.zipFiles) { // TODO: use PeThreadObject which does synchronization
Thread currentThread = Thread.currentThread();
HashMap map = null;
ZipFile zipFile;
- if ((map = (HashMap)this.zipFiles.get(currentThread)) != null
+ if ((map = (HashMap)this.zipFiles.get(currentThread)) != null
&& (zipFile = (ZipFile)map.get(path)) != null) {
-
+
return zipFile;
}
String fileSystemPath= null;
@@ -1311,7 +1316,7 @@ public class JavaModelManager implements ISaveParticipant {
} else {
fileSystemPath= path.toOSString();
}
-
+
try {
if (ZIP_ACCESS_VERBOSE) {
System.out.println("(" + currentThread + ") [JavaModelManager.getZipFile(IPath)] Creating ZipFile on " + fileSystemPath ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1334,10 +1339,10 @@ public class JavaModelManager implements ISaveParticipant {
}
// public void loadVariablesAndContainers() throws CoreException {
//
-// // backward compatibility, consider persistent property
+// // backward compatibility, consider persistent property
// QualifiedName qName = new QualifiedName(PHPCore.PLUGIN_ID, "variables"); //$NON-NLS-1$
// String xmlString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName);
-//
+//
// try {
// if (xmlString != null){
// StringReader reader = new StringReader(xmlString);
@@ -1356,7 +1361,7 @@ public class JavaModelManager implements ISaveParticipant {
// if (!cpElement.getNodeName().equalsIgnoreCase("variables")) { //$NON-NLS-1$
// return;
// }
-//
+//
// NodeList list= cpElement.getChildNodes();
// int length= list.getLength();
// for (int i= 0; i < length; ++i) {
@@ -1365,7 +1370,7 @@ public class JavaModelManager implements ISaveParticipant {
// if (type == Node.ELEMENT_NODE) {
// Element element= (Element) node;
// if (element.getNodeName().equalsIgnoreCase("variable")) { //$NON-NLS-1$
-// variablePut(
+// variablePut(
// element.getAttribute("name"), //$NON-NLS-1$
// new Path(element.getAttribute("path"))); //$NON-NLS-1$
// }
@@ -1377,9 +1382,9 @@ public class JavaModelManager implements ISaveParticipant {
// if (xmlString != null){
// ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(qName, null); // flush old one
// }
-//
+//
// }
-//
+//
// // load variables and containers from preferences into cache
// Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
@@ -1391,8 +1396,8 @@ public class JavaModelManager implements ISaveParticipant {
// if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)){
// String varName = propertyName.substring(variablePrefixLength);
// IPath varPath = new Path(preferences.getString(propertyName).trim());
-//
-// Variables.put(varName, varPath);
+//
+// Variables.put(varName, varPath);
// PreviousSessionVariables.put(varName, varPath);
// }
// if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)){
@@ -1432,11 +1437,11 @@ public class JavaModelManager implements ISaveParticipant {
public IJavaElementDelta mergeDeltas(Collection deltas) {
if (deltas.size() == 0) return null;
if (deltas.size() == 1) return (IJavaElementDelta)deltas.iterator().next();
-
+
if (DeltaProcessor.VERBOSE) {
System.out.println("MERGING " + deltas.size() + " DELTAS ["+Thread.currentThread()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
+
Iterator iterator = deltas.iterator();
IJavaElement javaModel = this.getJavaModel();
JavaElementDelta rootDelta = new JavaElementDelta(javaModel);
@@ -1472,7 +1477,7 @@ public class JavaModelManager implements ISaveParticipant {
else {
return null;
}
- }
+ }
/**
* Returns the info for this element without
@@ -1487,14 +1492,14 @@ public class JavaModelManager implements ISaveParticipant {
*/
public void prepareToSave(ISaveContext context) throws CoreException {
}
-
+
protected void putInfo(IJavaElement element, Object info) {
this.cache.putInfo(element, info);
}
/*
* Puts the infos in the given map (keys are IJavaElements and values are JavaElementInfos)
* in the Java model cache in an atomic way.
- * First checks that the info for the opened element (or one of its ancestors) has not been
+ * First checks that the info for the opened element (or one of its ancestors) has not been
* added to the cache. If it is the case, another thread has opened the element (or one of
* its ancestors). So returns without updating the cache.
*/
@@ -1512,7 +1517,7 @@ public class JavaModelManager implements ISaveParticipant {
}
}
}
-
+
Iterator iterator = newElements.keySet().iterator();
while (iterator.hasNext()) {
IJavaElement element = (IJavaElement)iterator.next();
@@ -1558,7 +1563,7 @@ public class JavaModelManager implements ISaveParticipant {
// final String projectName = propertyName.substring(containerPrefixLength, index).trim();
// JavaProject project = (JavaProject)getJavaModelManager().getJavaModel().getJavaProject(projectName);
// final IPath containerPath = new Path(propertyName.substring(index+1).trim());
-//
+//
// if (containerString == null || containerString.equals(CP_ENTRY_IGNORE)) {
// containerPut(project, containerPath, null);
// } else {
@@ -1572,7 +1577,7 @@ public class JavaModelManager implements ISaveParticipant {
// return "Persisted container ["+containerPath+" for project ["+ projectName+"]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
// }
// public int getKind() {
-// return 0;
+// return 0;
// }
// public IPath getPath() {
// return containerPath;
@@ -1602,39 +1607,39 @@ public class JavaModelManager implements ISaveParticipant {
protected void registerJavaModelDelta(IJavaElementDelta delta) {
this.javaModelDeltas.add(delta);
}
-
+
/**
* Remembers the given scope in a weak set
* (so no need to remove it: it will be removed by the garbage collector)
*/
// public void rememberScope(AbstractSearchScope scope) {
// // NB: The value has to be null so as to not create a strong reference on the scope
-// this.scopes.put(scope, null);
+// this.scopes.put(scope, null);
// }
/**
* removeElementChangedListener method comment.
*/
public void removeElementChangedListener(IElementChangedListener listener) {
-
+
for (int i = 0; i < this.elementChangedListenerCount; i++){
-
+
if (this.elementChangedListeners[i].equals(listener)){
-
+
// need to clone defensively since we might be in the middle of listener notifications (#fire)
int length = this.elementChangedListeners.length;
IElementChangedListener[] newListeners = new IElementChangedListener[length];
System.arraycopy(this.elementChangedListeners, 0, newListeners, 0, i);
int[] newMasks = new int[length];
System.arraycopy(this.elementChangedListenerMasks, 0, newMasks, 0, i);
-
+
// copy trailing listeners
int trailingLength = this.elementChangedListenerCount - i - 1;
if (trailingLength > 0){
System.arraycopy(this.elementChangedListeners, i+1, newListeners, i, trailingLength);
System.arraycopy(this.elementChangedListenerMasks, i+1, newMasks, i, trailingLength);
}
-
+
// update manager listener state (#fire need to iterate over original listeners through a local variable to hold onto
// the original ones)
this.elementChangedListeners = newListeners;
@@ -1644,15 +1649,15 @@ public class JavaModelManager implements ISaveParticipant {
}
}
}
-
+
/**
* Remembers the given scope in a weak set
* (so no need to remove it: it will be removed by the garbage collector)
*/
// public void rememberScope(AbstractSearchScope scope) {
// // NB: The value has to be null so as to not create a strong reference on the scope
-// this.searchScopes.put(scope, null);
-// }
+// this.searchScopes.put(scope, null);
+// }
/*
* Removes all cached info for the given element (including all children)
* from the cache.
@@ -1687,7 +1692,7 @@ public class JavaModelManager implements ISaveParticipant {
return info;
}
return null;
- }
+ }
public void removePerProjectInfo(JavaProject javaProject) {
synchronized(perProjectInfo) { // use the perProjectInfo collection as its own lock
IProject project = javaProject.getProject();
@@ -1713,11 +1718,11 @@ public class JavaModelManager implements ISaveParticipant {
// passed this point, save actions are non trivial
if (context.getKind() == ISaveContext.SNAPSHOT) return;
-
+
// save built state
if (info.triedRead) saveBuiltState(info);
}
-
+
/**
* Saves the built state for the project.
*/
@@ -1758,7 +1763,7 @@ public class JavaModelManager implements ISaveParticipant {
}
}
private synchronized Map containerClone(IJavaProject project) {
- Map originalProjectContainers = (Map)this.containers.get(project);
+ Map originalProjectContainers = (Map)this.containers.get(project);
if (originalProjectContainers == null) return null;
Map projectContainers = new HashMap(originalProjectContainers.size());
projectContainers.putAll(originalProjectContainers);
@@ -1768,7 +1773,7 @@ public class JavaModelManager implements ISaveParticipant {
* @see ISaveParticipant
*/
public void saving(ISaveContext context) throws CoreException {
-
+
// save container values on snapshot/full save
Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
IJavaProject[] projects = getJavaModel().getJavaProjects();
@@ -1794,11 +1799,11 @@ public class JavaModelManager implements ISaveParticipant {
}
}
JavaCore.getPlugin().savePluginPreferences();
-
+
// if (context.getKind() == ISaveContext.FULL_SAVE) {
// // will need delta since this save (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658)
// context.needDelta();
-//
+//
// // clean up indexes on workspace full save
// // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52347)
// IndexManager manager = this.indexManager;
@@ -1806,7 +1811,7 @@ public class JavaModelManager implements ISaveParticipant {
// manager.cleanUpIndexes();
// }
// }
-
+
IProject savedProject = context.getProject();
if (savedProject != null) {
if (!JavaProject.hasJavaNature(savedProject)) return; // ignore
@@ -1836,7 +1841,7 @@ public class JavaModelManager implements ISaveParticipant {
* @see ISaveParticipant
*/
// public void saving(ISaveContext context) throws CoreException {
-//
+//
// IProject savedProject = context.getProject();
// if (savedProject != null) {
// if (!JavaProject.hasJavaNature(savedProject)) return; // ignore
@@ -1872,9 +1877,9 @@ public class JavaModelManager implements ISaveParticipant {
// optional behaviour
// possible value of index 0 is Compute
if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level
-
+
if (javaBuildOrder == null || javaBuildOrder.length <= 1) return;
-
+
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
String[] wksBuildOrder = description.getBuildOrder();
@@ -1965,7 +1970,7 @@ public class JavaModelManager implements ISaveParticipant {
public void stopDeltas() {
this.isFiring= false;
}
-
+
/**
* Update Java Model given some delta
*/
@@ -1982,7 +1987,7 @@ public class JavaModelManager implements ISaveParticipant {
}
-
+
public static IPath variableGet(String variableName){
return (IPath)Variables.get(variableName);
}
@@ -1997,10 +2002,10 @@ public class JavaModelManager implements ISaveParticipant {
}
return result;
}
-
- public static void variablePut(String variableName, IPath variablePath){
- // update cache - do not only rely on listener refresh
+ public static void variablePut(String variableName, IPath variablePath){
+
+ // update cache - do not only rely on listener refresh
if (variablePath == null) {
Variables.remove(variableName);
PreviousSessionVariables.remove(variableName);
@@ -2011,7 +2016,7 @@ public class JavaModelManager implements ISaveParticipant {
// do not write out intermediate initialization value
if (variablePath == JavaModelManager.VariableInitializationInProgress){
return;
- }
+ }
Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName;
String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString();
@@ -2026,8 +2031,8 @@ public class JavaModelManager implements ISaveParticipant {
*/
public ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner, boolean addPrimary) {
synchronized(perWorkingCopyInfos) {
- ICompilationUnit[] primaryWCs = addPrimary && owner != DefaultWorkingCopyOwner.PRIMARY
- ? getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, false)
+ ICompilationUnit[] primaryWCs = addPrimary && owner != DefaultWorkingCopyOwner.PRIMARY
+ ? getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, false)
: null;
Map workingCopyToInfos = (Map)perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null) return primaryWCs;
@@ -2043,14 +2048,14 @@ public class JavaModelManager implements ISaveParticipant {
result[index++] = ((JavaModelManager.PerWorkingCopyInfo)iterator.next()).getWorkingCopy();
}
return result;
- }
+ }
}
-
+
/*
* A HashSet that contains the IJavaProject whose classpath is being resolved.
*/
private ThreadLocal classpathsBeingResolved = new ThreadLocal();
-
+
private HashSet getClasspathBeingResolved() {
HashSet result = (HashSet) this.classpathsBeingResolved.get();
if (result == null) {
@@ -2062,7 +2067,7 @@ public class JavaModelManager implements ISaveParticipant {
public boolean isClasspathBeingResolved(IJavaProject project) {
return getClasspathBeingResolved().contains(project);
}
-
+
public void setClasspathBeingResolved(IJavaProject project, boolean classpathIsResolved) {
if (classpathIsResolved) {
getClasspathBeingResolved().add(project);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
index b205146..261673f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
@@ -1,6 +1,6 @@
/*
* Created on 09.08.2003
- *
+ *
*/
package net.sourceforge.phpdt.internal.ui.util;
@@ -18,44 +18,58 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
public class PHPFileUtil {
- private static String[] PHP_EXTENSIONS = null;
+// private static String[] PHP_EXTENSIONS = null;
public final static String[] SMARTY_EXTENSIONS = { "tpl" };
public static boolean isPHPFile(IFile file) {
- String extension = file.getFileExtension();
+// String extension = file.getFileExtension();
return isPHPFileName(file.getLocation().toString());
}
- public final static String getFileExtension(String name) {
- int index = name.lastIndexOf('.');
- if (index == -1)
- return null;
- if (index == (name.length() - 1))
- return null; //$NON-NLS-1$
- return name.substring(index + 1);
- }
+// public final static String getFileExtension(String name) {
+// int index = name.lastIndexOf('.');
+// if (index == -1)
+// return null;
+// if (index == (name.length() - 1))
+// return null; //$NON-NLS-1$
+// return name.substring(index + 1);
+// }
/**
* Returns true iff str.toLowerCase().endsWith(".php") implementation is not creating extra strings.
*/
public final static boolean isPHPFileName(String name) {
- String extension = getFileExtension(name);
- if (extension == null) {
- return false;
- }
- extension = extension.toLowerCase();
- PHP_EXTENSIONS = getExtensions();
- if (PHP_EXTENSIONS == null) {
- return false;
- }
- for (int i = 0; i < PHP_EXTENSIONS.length; i++) {
- if (extension.equals(PHP_EXTENSIONS[i])) {
+
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IEditorRegistry registry = workbench.getEditorRegistry();
+ IEditorDescriptor[] descriptors = registry.getEditors(name);
+
+ for (int i = 0; i < descriptors.length; i++) {
+ if (descriptors[i].getId().equals(PHPeclipsePlugin.EDITOR_ID)) {
return true;
- }
- }
+ }
+ }
+// String extension = getFileExtension(name);
+// if (extension == null) {
+// return false;
+// }
+// extension = extension.toLowerCase();
+// PHP_EXTENSIONS = getExtensions();
+// if (PHP_EXTENSIONS == null) {
+// return false;
+// }
+// for (int i = 0; i < PHP_EXTENSIONS.length; i++) {
+// if (extension.equals(PHP_EXTENSIONS[i])) {
+// return true;
+// }
+// }
return false;
}
@@ -69,43 +83,43 @@ public class PHPFileUtil {
/**
* @return Returns the PHP extensions.
*/
- public static String[] getExtensions() {
- if (PHP_EXTENSIONS == null) {
- ArrayList list = new ArrayList();
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- String extensions = store.getString(PHPeclipsePlugin.PHP_EXTENSION_PREFS);
- extensions = extensions.trim();
- if (extensions.length() != 0) {
- StringTokenizer tokenizer = new StringTokenizer(extensions, " ,;:/-|");
- String token;
- while (tokenizer.hasMoreTokens()) {
- token = tokenizer.nextToken();
- if (token != null && token.length() >= 1) {
- list.add(token);
- }
- }
- if (list.size() != 0) {
- PHP_EXTENSIONS = new String[list.size()];
- for (int i = 0; i < list.size(); i++) {
- PHP_EXTENSIONS[i] = (String) list.get(i);
- }
- }
- }
- }
- return PHP_EXTENSIONS;
- }
+// public static String[] getExtensions() {
+// if (PHP_EXTENSIONS == null) {
+// ArrayList list = new ArrayList();
+// final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+// String extensions = store.getString(PHPeclipsePlugin.PHP_EXTENSION_PREFS);
+// extensions = extensions.trim();
+// if (extensions.length() != 0) {
+// StringTokenizer tokenizer = new StringTokenizer(extensions, " ,;:/-|");
+// String token;
+// while (tokenizer.hasMoreTokens()) {
+// token = tokenizer.nextToken();
+// if (token != null && token.length() >= 1) {
+// list.add(token);
+// }
+// }
+// if (list.size() != 0) {
+// PHP_EXTENSIONS = new String[list.size()];
+// for (int i = 0; i < list.size(); i++) {
+// PHP_EXTENSIONS[i] = (String) list.get(i);
+// }
+// }
+// }
+// }
+// return PHP_EXTENSIONS;
+// }
/**
* @param php_extensions
* The PHP extensions to set.
*/
- public static void setExtensions(String[] php_extensions) {
- PHP_EXTENSIONS = php_extensions;
- }
+// public static void setExtensions(String[] php_extensions) {
+// PHP_EXTENSIONS = php_extensions;
+// }
/**
* Creata the file for the given absolute file path
- *
+ *
* @param absoluteFilePath
* @param project
* @return the file for the given absolute file path or null
if no existing file can be found
@@ -123,7 +137,7 @@ public class PHPFileUtil {
/**
* Determine the path of an include name string
- *
+ *
* @param includeNameString
* @param resource
* @param project
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
index 518a3bd..ee2d646 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java
@@ -37,7 +37,6 @@ import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCompletionProcessor;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.phpeditor.html.HTMLFormattingStrategy;
import net.sourceforge.phpeclipse.phpeditor.php.HTMLCompletionProcessor;
import net.sourceforge.phpeclipse.phpeditor.php.PHPAutoIndentStrategy;
import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
@@ -98,14 +97,14 @@ import org.eclipse.ui.texteditor.ITextEditor;
public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Preference key used to look up display tab width.
- *
+ *
* @since 2.0
*/
public final static String PREFERENCE_TAB_WIDTH = PreferenceConstants.EDITOR_TAB_WIDTH;
/**
* Preference key for inserting spaces rather than tabs.
- *
+ *
* @since 2.0
*/
public final static String SPACES_FOR_TABS = PreferenceConstants.EDITOR_SPACES_FOR_TABS;
@@ -113,21 +112,19 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
// public static final String HTML_DEFAULT =
// IPHPPartitionScannerConstants.HTML;
//IDocument.DEFAULT_CONTENT_TYPE;
- private JavaTextTools fJavaTextTools;
+// private JavaTextTools fJavaTextTools;
private ITextEditor fTextEditor;
/**
* The document partitioning.
- *
+ *
* @since 3.0
*/
private String fDocumentPartitioning;
private ContentFormatter fFormatter;
- private HTMLFormattingStrategy fFormattingStrategy;
-
/**
* Single token scanner.
*/
@@ -139,27 +136,27 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* The document partitioning.
- *
+ *
* @since 3.0
*/
// private String fDocumentPartitioning;
/**
* The Java source code scanner
- *
+ *
* @since 3.0
*/
private AbstractJavaScanner fCodeScanner;
/**
* The Java multi-line comment scanner
- *
+ *
* @since 3.0
*/
private AbstractJavaScanner fMultilineCommentScanner;
/**
* The Java single-line comment scanner
- *
+ *
* @since 3.0
*/
private AbstractJavaScanner fSinglelineCommentScanner;
@@ -172,24 +169,24 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
* The PHP single quoted string scanner
*/
private AbstractJavaScanner fStringSQScanner;
-
+
/**
* The Javadoc scanner
- *
+ *
* @since 3.0
*/
private AbstractJavaScanner fJavaDocScanner;
/**
* The preference store, can be read-only
- *
+ *
* @since 3.0
*/
private IPreferenceStore fPreferenceStore;
/**
* The color manager
- *
+ *
* @since 3.0
*/
private IColorManager fColorManager;
@@ -206,7 +203,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
* {@link JavaSourceViewerConfiguration#handlePropertyChangeEvent(PropertyChangeEvent)}and disallowed to call
* {@link JavaSourceViewerConfiguration#getPreferenceStore()}on the resulting Java source viewer configuration.
* true
if event causes a behavioral change
@@ -305,14 +302,14 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
* null
.
- *
+ *
* @return the partition managing position categories or null
if there is none
*/
public String[] getPartitionManagingPositionCategories() {
@@ -383,9 +380,9 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the preference store used by this configuration to initialize the individual bits and pieces.
- *
+ *
* @return the preference store used to initialize this configuration
- *
+ *
* @since 2.0
*/
protected IPreferenceStore getPreferenceStore() {
@@ -417,7 +414,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
* (non-Javadoc) Method declared on SourceViewerConfiguration
*/
public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
- if (IPHPPartitions.PHP_PHPDOC_COMMENT.equals(contentType)
+ if (IPHPPartitions.PHP_PHPDOC_COMMENT.equals(contentType)
|| IPHPPartitions.PHP_MULTILINE_COMMENT.equals(contentType))
return new JavaDocAutoIndentStrategy(getConfiguredDocumentPartitioning(sourceViewer));
if (IPHPPartitions.PHP_STRING_DQ.equals(contentType))
@@ -433,7 +430,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the PHP source code scanner for this configuration.
- *
+ *
* @return the PHP source code scanner
*/
protected RuleBasedScanner getCodeScanner() {
@@ -442,7 +439,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the Java multi-line comment scanner for this configuration.
- *
+ *
* @return the Java multi-line comment scanner
* @since 2.0
*/
@@ -452,7 +449,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the Java single-line comment scanner for this configuration.
- *
+ *
* @return the Java single-line comment scanner
* @since 2.0
*/
@@ -462,7 +459,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the PHP double quoted string scanner for this configuration.
- *
+ *
* @return the PHP double quoted string scanner
*/
protected RuleBasedScanner getStringDQScanner() {
@@ -471,7 +468,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the PHP single quoted string scanner for this configuration.
- *
+ *
* @return the PHP single quoted string scanner
*/
protected RuleBasedScanner getStringSQScanner() {
@@ -479,7 +476,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
}
/**
* Returns the HTML source code scanner for this configuration.
- *
+ *
* @return the HTML source code scanner
*/
// protected RuleBasedScanner getHTMLScanner() {
@@ -487,7 +484,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
// }
/**
* Returns the Smarty source code scanner for this configuration.
- *
+ *
* @return the Smarty source code scanner
*/
// protected RuleBasedScanner getSmartyScanner() {
@@ -581,7 +578,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the SmartyDoc source code scanner for this configuration.
- *
+ *
* @return the SmartyDoc source code scanner
*/
// protected RuleBasedScanner getSmartyDocScanner() {
@@ -589,7 +586,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
// }
/**
* Returns the PHPDoc source code scanner for this configuration.
- *
+ *
* @return the PHPDoc source code scanner
*/
protected RuleBasedScanner getPHPDocScanner() {
@@ -743,28 +740,28 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* @return true
iff the new setup without text tools is in use.
- *
+ *
* @since 3.0
*/
- private boolean isNewSetup() {
- return fJavaTextTools == null;
- }
+// private boolean isNewSetup() {
+// return fJavaTextTools == null;
+// }
/**
* Creates and returns a preference store which combines the preference stores from the text tools and which is read-only.
- *
+ *
* @return the read-only preference store
* @since 3.0
*/
- private IPreferenceStore createPreferenceStore() {
- Assert.isTrue(!isNewSetup());
- IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
- if (fJavaTextTools.getCorePreferenceStore() == null)
- return new ChainedPreferenceStore(new IPreferenceStore[] { fJavaTextTools.getPreferenceStore(), generalTextStore });
-
- return new ChainedPreferenceStore(new IPreferenceStore[] { fJavaTextTools.getPreferenceStore(),
- new PreferencesAdapter(fJavaTextTools.getCorePreferenceStore()), generalTextStore });
- }
+// private IPreferenceStore createPreferenceStore() {
+// Assert.isTrue(!isNewSetup());
+// IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
+// if (fJavaTextTools.getCorePreferenceStore() == null)
+// return new ChainedPreferenceStore(new IPreferenceStore[] { fJavaTextTools.getPreferenceStore(), generalTextStore });
+//
+// return new ChainedPreferenceStore(new IPreferenceStore[] { fJavaTextTools.getPreferenceStore(),
+// new PreferencesAdapter(fJavaTextTools.getCorePreferenceStore()), generalTextStore });
+// }
/*
* (non-Javadoc) Method declared on SourceViewerConfiguration
@@ -823,7 +820,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_DQ);
phpDR = new DefaultDamagerRepairer(getStringSQScanner());
phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_SQ);
- phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_SQ);
+ phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_SQ);
phpDR = new DefaultDamagerRepairer(getSinglelineCommentScanner());
phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);
phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);
@@ -834,7 +831,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
PresentationReconciler reconciler = new PresentationReconciler();
reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
//
- JavaTextTools jspTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+// JavaTextTools jspTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getPHPDocScanner());//jspTextTools.getJSPTextScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
@@ -944,7 +941,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the information presenter control creator. The creator is a factory creating the presenter controls for the given
* source viewer. This implementation always returns a creator for DefaultInformationControl
instances.
- *
+ *
* @param sourceViewer
* the source viewer to be configured by this configuration
* @return an information control creator
@@ -964,7 +961,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the outline presenter control creator. The creator is a factory creating outline presenter controls for the given
* source viewer. This implementation always returns a creator for JavaOutlineInformationControl
instances.
- *
+ *
* @param sourceViewer
* the source viewer to be configured by this configuration
* @return an information control creator
@@ -982,7 +979,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Returns the outline presenter which will determine and shown information requested for the current cursor position.
- *
+ *
* @param sourceViewer
* the source viewer to be configured by this configuration
* @param doCodeResolve
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
index cec00dc..f0f5946 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
@@ -18,14 +18,14 @@ package net.sourceforge.phpeclipse;
public interface IPreferenceConstants {
/**
* Preference key suffix for bold text style preference keys.
- *
+ *
* @since 2.1
*/
public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$
/**
* Preference key suffix for italic text style preference keys.
- *
+ *
* @since 3.0
*/
public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$
@@ -55,9 +55,9 @@ public interface IPreferenceConstants {
// public static final String APACHE_RESTART_BACKGROUND = "_apache_restart_background";
//
// public static final String APACHE_RESTART_PREF = "__apache_restart";
-
+
// public static final String HTTPD_CONF_PATH_PREF = "__httpd_conf_path";
-//
+//
// public static final String ETC_HOSTS_PATH_PREF = "__etc_hosts_path";
// public static final String SHOW_OUTPUT_IN_CONSOLE = "_show_output_in_console";
@@ -66,8 +66,8 @@ public interface IPreferenceConstants {
//
// public static final String EXTERNAL_PARSER_PREF = "_external_parser";
- public static final String PHP_EXTENSION_PREFS = "_php_parser_extensions";
-
+// public static final String PHP_EXTENSION_PREFS = "_php_parser_extensions";
+
// public static final String PHP_PARSER_DEFAULT = "_php_parser_default";
// public static final String PHP_INTERNAL_PARSER = "_php_internal_parser";
@@ -83,14 +83,14 @@ public interface IPreferenceConstants {
/**
* The color key for operators and brackets in PHP code (value "__php_operator"
).
- *
+ *
* @since 3.0
*/
public static final String PHP_OPERATOR = "__php_operator"; //$NON-NLS-1$
/**
* The color key for {} in PHP code (value "__php_brace_operator"
).
- *
+ *
* @since 3.0
*/
public static final String PHP_BRACE_OPERATOR = "__php_brace_operator"; //$NON-NLS-1$
@@ -100,7 +100,7 @@ public interface IPreferenceConstants {
* String
. A RGB color value encoded as a string using class PreferenceConverter
* Boolean
.
* Boolean
.
* String
. A RGB color value encoded as a string using class PreferenceConverter
* Boolean
.
* Boolean
.
* "__php_keyword_return"
).
- *
+ *
* @since 3.0
*/
public static final String PHP_KEYWORD_RETURN = "__php_keyword_return"; //$NON-NLS-1$
@@ -171,7 +171,7 @@ public interface IPreferenceConstants {
* String
. A RGB color value encoded as a string using class PreferenceConverter
* Boolean
.
* Boolean
.
* "net.sourceforge.phpeclipse"
).
*/
public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$
+ public static final String EDITOR_ID = PHPeclipsePlugin.PLUGIN_ID+".PHPUnitEditor";
public static final String ID_PERSPECTIVE = "net.sourceforge.phpeclipse.PHPPerspective"; //$NON-NLS-1$
-
+
IWorkspace w;
/**
@@ -145,27 +146,27 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
/**
* The key to store customized templates.
- *
+ *
* @since 3.0
*/
private static final String TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_templates"; //$NON-NLS-1$
/**
* The key to store customized code templates.
- *
+ *
* @since 3.0
*/
private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$
/**
* The key to store whether the legacy templates have been migrated
- *
+ *
* @since 3.0
*/
// private static final String TEMPLATES_MIGRATION_KEY= "net.sourceforge.phpdt.ui.text.templates_migrated"; //$NON-NLS-1$
/**
* The key to store whether the legacy code templates have been migrated
- *
+ *
* @since 3.0
*/
// private static final String CODE_TEMPLATES_MIGRATION_KEY= "net.sourceforge.phpdt.ui.text.code_templates_migrated";
@@ -208,28 +209,28 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
/**
* The template context type registry for the java editor.
- *
+ *
* @since 3.0
*/
private ContextTypeRegistry fContextTypeRegistry;
/**
* The code template context type registry for the java editor.
- *
+ *
* @since 3.0
*/
private ContextTypeRegistry fCodeTemplateContextTypeRegistry;
/**
* The template store for the java editor.
- *
+ *
* @since 3.0
*/
private TemplateStore fTemplateStore;
/**
* The coded template store for the java editor.
- *
+ *
* @since 3.0
*/
private TemplateStore fCodeTemplateStore;
@@ -271,27 +272,27 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
/**
* Property change listener on this plugin's preference store.
- *
+ *
* @since 3.0
*/
// private IPropertyChangeListener fPropertyChangeListener;
/**
* The combined preference store.
- *
+ *
* @since 3.0
*/
private IPreferenceStore fCombinedPreferenceStore;
/**
* The extension point registry for the net.sourceforge.phpdt.ui.javaFoldingStructureProvider
extension point.
- *
+ *
* @since 3.0
*/
private JavaFoldingStructureProviderRegistry fFoldingStructureProviderRegistry;
/**
* Mockup preference store for firing events and registering listeners on project setting changes. FIXME: Temporary solution.
- *
+ *
* @since 3.0
*/
private MockupPreferenceStore fMockupPreferenceStore;
@@ -327,7 +328,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
// }
/**
* Returns all Java editor text hovers contributed to the workbench.
- *
+ *
* @return an array of JavaEditorTextHoverDescriptor
* @since 2.1
*/
@@ -414,7 +415,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
* net.sourceforge.phpdt.ui.javaFoldingStructureProvider
extension
* point.
- *
+ *
* @return the registry of contributed IJavaFoldingStructureProvider
* @since 3.0
*/
@@ -1377,7 +1378,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
* IWorkspace.run(...)
for more details.
*
sourceString
,
- * and returns a string containing the formatted version.
- *
- * @param string the string to format
- * @param indentationLevel the initial indentation level, used
- * to shift left/right the entire source fragment. An initial indentation
- * level of zero has no effect.
- * @param positions an array of positions to map. These are
- * character-based source positions inside the original source,
- * for which corresponding positions in the formatted source will
- * be computed (so as to relocate elements associated with the original
- * source). It updates the positions array with updated positions.
- * If set to null
, then no positions are mapped.
- * @param lineSeparator the line separator to use in formatted source,
- * if set to null
, then the platform default one will be used.
- * @return the formatted output string.
- */
- public String format(
- String string,
- int indentationLevel,
- int[] positions,
- String lineSeparator,
- String inputname) {
- StringWriter ret = new StringWriter(2048);
- try {
- if (PHPeclipsePlugin.DEBUG) {
- System.err.println(NAME + ".format(): inputname=" + inputname);
- }
-// TidyHTMLParser parser = new TidyHTMLParser(new TidyConfiguration(fEditor, fViewer));
-// parser.setCompactFormat(
-// ((Boolean) fViewer.getData(IConstants.KEY_COMPACT_FORMAT)).booleanValue());
-// parser.parse(new StringReader(string), inputname, new PrintWriter(ret));
-// if (parser.getParseErrors() != 0) {
-// PHPeclipsePlugin.log(IStatus.INFO, "Parse error");
-// return string;
-// }
- return ret.toString();
- } catch (Exception e) {
- // PHPeclipsePlugin.error("Unknown parse error: "+e.getMessage(), null, fEditor.getEditorInput(), fViewer);
- PHPeclipsePlugin.log(IStatus.ERROR, e.getMessage());
- return string;
- }
- }
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/HTMLFormattingStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/HTMLFormattingStrategy.java
deleted file mode 100644
index eba86b6..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/HTMLFormattingStrategy.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package net.sourceforge.phpeclipse.phpeditor.html;
-
-import net.sourceforge.phpdt.ui.text.PHPSourceViewerConfiguration;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * @author chrisl
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>ObfuscatorIgnores.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class HTMLFormattingStrategy implements IFormattingStrategy, IHTMLConstants {
-
- ////////////////////////////////////////////////////////////////////////
-
- private PHPSourceViewerConfiguration fConfig;
- private ISourceViewer fViewer;
- //
- private ITextEditor fEditor;
- private int fTabWidth;
-
- ////////////////////////////////////////////////////////////////////////
-
- public HTMLFormattingStrategy(PHPSourceViewerConfiguration cf, ISourceViewer viewer) {
- fConfig = cf;
- fViewer = viewer;
- //
- fEditor = fConfig.getEditor();
- initPreferences();
- }
-
- public void initPreferences() {
- fTabWidth=fConfig.getTabWidth(fViewer);
- }
-
- ////////////////////////////////////////////////////////////////////////
-
- /**
- * @see IFormattingStrategy#formatterStarts(String)
- */
- public void formatterStarts(String initialIndentation) {
- }
-
- /**
- * @see IFormattingStrategy#formatterStops()
- */
- public void formatterStops() {
- }
-
- /**
- * @see IFormattingStrategy#format(String, boolean, String, int[])
- */
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- HTMLFormatter formatter = new HTMLFormatter(fConfig, (SourceViewer) fViewer);
- IDocument doc = fViewer.getDocument();
- String lineDelimiter = getLineDelimiterFor(doc);
- int indent = 0;
- if (indentation != null) {
- indent = computeIndent(indentation, fTabWidth);
- }
- return formatter.format(content, indent, positions, lineDelimiter, fEditor.getEditorInput().getName());
- }
-
- public static String getLineDelimiterFor(IDocument doc) {
- String lineDelim = null;
- try {
- lineDelim = doc.getLineDelimiter(0);
- } catch (BadLocationException e) {
- }
- if (lineDelim == null) {
- String systemDelimiter = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- String[] lineDelims = doc.getLegalLineDelimiters();
- for (int i = 0; i < lineDelims.length; i++) {
- if (lineDelims[i].equals(systemDelimiter)) {
- lineDelim = systemDelimiter;
- break;
- }
- }
- if (lineDelim == null) {
- lineDelim = lineDelims.length > 0 ? lineDelims[0] : systemDelimiter;
- }
- }
- return lineDelim;
- }
-
- /**
- * Returns the indent of the given string.
- *
- * @param line the text line
- * @param tabWidth the width of the '\t' character.
- *
- * @see net.sourceforge.phpdt.internal.corext.util.Strings.computeIndent(String,int)
- */
- public static int computeIndent(String line, int tabWidth) {
- int result = 0;
- int blanks = 0;
- int size = line.length();
- for (int i = 0; i < size; i++) {
- char c = line.charAt(i);
- if (c == '\t') {
- result++;
- blanks = 0;
- } else if (Character.isSpaceChar(c)) {
- blanks++;
- if (blanks == tabWidth) {
- result++;
- blanks = 0;
- }
- } else {
- return result;
- }
- }
- return result;
- }
-
- ////////////////////////////////////////////////////////////////////////
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/IHTMLConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/IHTMLConstants.java
deleted file mode 100644
index 96cc755..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/html/IHTMLConstants.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package net.sourceforge.phpeclipse.phpeditor.html;
-
-
-/**
- * @author chrisl
- */
-public interface IHTMLConstants {
-
- int NONE=0;
- int TEXT=1;
- int FOLDER=2;
- int ANCHOR=3;
-
- /**
- * Tags that do not allow end tag.
- * Required that tags that allow optional end tag should always have end tag.
- */
- String[] EMPTY_TAGS =
- new String[] {
- "AREA",
- "BASE",
- "BASEFONT",
- "BR",
- "COL",
- "FRAME",
- "HR",
- "IMG",
- "INPUT",
- "ISINDEX",
- "LINK",
- "META",
- "PARAM",
- };
-
- String[] START_TAGS =
- new String[] {
- "A",
- "ADDRESS",
- "APPLET",
- "B",
- "BIG",
- "BLOCKQUOTE",
- "BODY",
- "CAPTION",
- "CENTER",
- "CITE",
- "CODE",
- "COL",
- "COLGROUP",
- "DD",
- "DFN",
- "DIR",
- "DIV",
- "DL",
- "DT",
- "EM",
- "FONT",
- "FORM",
- "FRAMESET",
- "H1",
- "H2",
- "H3",
- "H4",
- "H5",
- "H6",
- "HEAD",
- "HTML",
- "I",
- "KBD",
- "LI",
- "MAP",
- "MENU",
- "NOBR",
- "NOFRAMES",
- "OBJECT",
- "OL",
- "OPTION",
- "P",
- "PRE",
- "SAMP",
- "SCRIPT",
- "SELECT",
- "SMALL",
- "SPAN",
- "STRIKE",
- "S",
- "STRONG",
- "STYLE",
- "SUB",
- "SUP",
- "TABLE",
- "TD",
- "TEXTAREA",
- "TH",
- "TITLE",
- "TR",
- "TT",
- "U",
- "UL",
- "VAR",
- };
-
- /** Line break before and after tag. */
- String[] BLOCK_TAGS =
- new String[] {
- "A",
- "APPLET",
- "AREA",
- "BASE",
- "BASEFONT",
- "BLOCKQUOTE",
- "BODY",
- "BR",
- "CAPTION",
- "CITE",
- "CODE",
- "DD",
- "DFN",
- "DIR",
- "DIV",
- "DL",
- "DT",
- "FORM",
- "FRAME",
- "FRAMESET",
- "H1",
- "H2",
- "H3",
- "H4",
- "H5",
- "H6",
- "HEAD",
- "HR",
- "HTML",
- "IMG",
- "INPUT",
- "ISINDEX",
- "LI",
- "LINK",
- "MAP",
- "MENU",
- "META",
- "NOBR",
- "NOFRAMES",
- "OBJECT",
- "OL",
- "OPTION",
- "P",
- "PARAM",
- "PRE",
- "SAMP",
- "SCRIPT",
- "SELECT",
- "STRIKE",
- "TABLE",
- "TD",
- "TEXTAREA",
- "TH",
- "TITLE",
- "TR",
- "UL",
- };
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java
index a4581f8..62687dd 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java
@@ -8,7 +8,7 @@
Contributors:
Igor Malinin - initial contribution
- $Id: PHPPartitionScanner.java,v 1.29 2005-05-15 23:24:41 axelcl Exp $
+ $Id: PHPPartitionScanner.java,v 1.30 2005-09-30 18:10:36 axelcl Exp $
**********************************************************************/
package net.sourceforge.phpeclipse.phpeditor.php;
@@ -26,8 +26,8 @@ import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
/**
- *
- *
+ *
+ *
* @author Igor Malinin
*/
public class PHPPartitionScanner implements IPartitionTokenScanner {
@@ -40,7 +40,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
private IDocument document;
- private int begin;
+// private int begin;
private int end;
@@ -50,7 +50,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
private int position;
- private int state;
+// private int state;
private Map tokens = new HashMap();
@@ -69,13 +69,13 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
switch (read()) {
case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(null);
case '<':
switch (read()) {
case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(null);
case '?': //
@@ -95,13 +95,13 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
loop: while (true) {
switch (read()) {
case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(null);
case '<':
switch (read()) {
case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(null);
case '?':
@@ -117,7 +117,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
unread();
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(null);
}
}
@@ -128,19 +128,19 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
while (true) {
switch (ch) {
case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
case '"': // double quoted string
// read until end of double quoted string
if (!readUntilEscapedDQ()) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
}
break;
case '\'': // single quoted string
// read until end of single quoted string
if (!readUntilEscapedSQ()) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
}
break;
@@ -152,14 +152,14 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
case '/':
// read until end of line
if (!readSingleLine()) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
}
break;
case '*':
// read until end of comment
if (!readMultiLineComment()) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
}
break;
@@ -170,7 +170,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
case '#': // line comment
// read until end of line
if (!readSingleLine()) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
}
break;
@@ -179,7 +179,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
switch (ch) {
case ICharacterScanner.EOF:
case '>':
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
return getToken(token);
case '?':
@@ -207,7 +207,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
// e.printStackTrace();
// }
// }
-
+
if (type == null) {
return Token.UNDEFINED;
}
@@ -257,16 +257,16 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
}
return false;
}
-
+
private boolean readUntilEscapedSQ() {
// search last single quoted character
- try {
+ try {
char ch;
while (true) {
if (position >= end) {
return false;
}
- ch = document.getChar(position++);
+ ch = document.getChar(position++);
if (ch == '\\') {
if (position >= end) {
return false;
@@ -288,7 +288,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
if (position >= end) {
return false;
}
- } while (document.getChar(position++) != '\n');
+ } while (document.getChar(position++) != '\n');
return true;
} catch (BadLocationException e) {
--position;
@@ -346,7 +346,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
*/
public void setRange(IDocument document, int offset, int length) {
this.document = document;
- this.begin = offset;
+// this.begin = offset;
this.end = offset + length;
this.offset = offset;
@@ -358,7 +358,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner {
* @see org.eclipse.jface.text.rules.IPartitionTokenScanner
*/
public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
- state = STATE_DEFAULT;
+// state = STATE_DEFAULT;
if (partitionOffset > -1) {
int delta = offset - partitionOffset;
if (delta > 0) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/Partition.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/Partition.java
deleted file mode 100644
index 4c260bf..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/Partition.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Created on 28.04.2003
- *
- */
-package net.sourceforge.phpeclipse.phpeditor.php;
-
-import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-
-/**
- * Defines a partition in a phpdocument. This class keeps tracks of
- * partitions contained within other partitions.
- *
- * @author Stefan Langer
- * @version $Revision: 1.4 $
- */
-public abstract class Partition
-{
- private IDocument fDocument;
- private IToken fContentToken;
- private String fParentPartition;
- private char[] fTextBuffer;
- private int fOffset = 0;
- private char entry;
- private char exit;
- private boolean inDoubleString = false;
- private boolean inSingleString = false;
-
- public Partition(IDocument document, char[] delim, String contentType, String parentPartition)
- {
- fDocument = document;
- fContentToken = new Token(contentType);
- fParentPartition = parentPartition;
- entry = delim[0];
- exit = delim[1];
- }
-
- public Partition(IDocument document, char[] delim, String contentType)
- {
- this(document, delim, contentType, IPHPPartitions.HTML);
- }
-
- /**
- * Checks wether the specified type is allowed within this
- * partition type.
- *
- * @param type The type of the partition to check.
- *
- * @return true
if the partition is allowed within this
- * partition otherwise false
.
- */
- abstract protected boolean allowedPartition(String type);
-
- abstract protected boolean scan();
-
- protected boolean isEnd()
- {
- return fOffset >= fTextBuffer.length;
- }
-
- protected int read()
- {
- if(fOffset > fTextBuffer.length)
- return ICharacterScanner.EOF;
-
- char ret = fTextBuffer[fOffset++];
- switch(ret)
- {
- case '\'':
- if(!inDoubleString)
- inSingleString = !inSingleString;
- break;
- case '"':
- if(!inSingleString)
- inDoubleString = !inDoubleString;
- break;
- }
- return ret;
- }
-
- protected void unread(int i)
- {
- for (int j = 0; j < i && fOffset > 0; j++)
- {
- char read = fTextBuffer[--fOffset];
-
- switch (read)
- {
- case '\'' :
- if (!inDoubleString)
- inSingleString = !inSingleString;
- break;
- case '"' :
- if (!inSingleString)
- inDoubleString = !inDoubleString;
- break;
- }
- } // END FOR
- }
-
- public boolean scanRange(int offset, int length)
- throws BadLocationException
- { // short circuit scanning if entry is not correct
- if (fDocument.getChar(offset) != entry)
- return false;
- // read the full range into the internal buffer
- fOffset = 0;
- inSingleString = false;
- inDoubleString = false;
- fTextBuffer = fDocument.get(offset, length).toCharArray();
- return scan();
- }
-
- protected boolean checkPattern(String pattern, boolean ignoreCase)
- {
- char[] checkPattern = pattern.toCharArray();
- int offset = fOffset;
- for(int i=0; i