diff --git a/plugins/com.aptana.core/src/com/aptana/core/CorePlugin.java b/plugins/com.aptana.core/src/com/aptana/core/CorePlugin.java index 9147d1b00a..f07eb0d820 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/CorePlugin.java +++ b/plugins/com.aptana.core/src/com/aptana/core/CorePlugin.java @@ -148,7 +148,7 @@ public void stop(BundleContext context) throws Exception /** * Returns the shared instance - * + * * @return the shared instance */ public static CorePlugin getDefault() @@ -158,7 +158,7 @@ public static CorePlugin getDefault() /** * Returns the {@link ISourceMapRegistry}. - * + * * @return {@link ISourceMapRegistry}. */ public synchronized ISourceMapRegistry getSourceMapRegistry() @@ -172,7 +172,7 @@ public synchronized ISourceMapRegistry getSourceMapRegistry() /** * Returns the {@link IDiagnosticManager}. - * + * * @return {@link IDiagnosticManager}. */ public synchronized IDiagnosticManager getDiagnosticManager() @@ -196,7 +196,7 @@ public static String getAptanaStudioVersion() /** * Returns the current bundle context - * + * * @return */ public BundleContext getContext() diff --git a/plugins/com.aptana.core/src/com/aptana/core/CoreStrings.java b/plugins/com.aptana.core/src/com/aptana/core/CoreStrings.java index 03d8708e40..84f2de1dd2 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/CoreStrings.java +++ b/plugins/com.aptana.core/src/com/aptana/core/CoreStrings.java @@ -29,7 +29,7 @@ public interface CoreStrings public static final String REFRESH = Messages.CoreStrings_Refresh; public static final String PROPERTIES = Messages.CoreStrings_Properties; - + public static final String CONTINUE = Messages.CoreStrings_Continue; public static final String CANCEL = Messages.CoreStrings_Cancel; diff --git a/plugins/com.aptana.core/src/com/aptana/core/Identifiable.java b/plugins/com.aptana.core/src/com/aptana/core/Identifiable.java index fdfa44e629..1c4c58a07c 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/Identifiable.java +++ b/plugins/com.aptana.core/src/com/aptana/core/Identifiable.java @@ -10,9 +10,9 @@ /** * @author Max Stepanov - * */ -public interface Identifiable { +public interface Identifiable +{ /** * @return id diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/PlatformPropertyTester.java b/plugins/com.aptana.core/src/com/aptana/core/internal/PlatformPropertyTester.java index 4760863b6e..991bc74325 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/PlatformPropertyTester.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/PlatformPropertyTester.java @@ -13,20 +13,25 @@ /** * @author Max Stepanov - * */ -public class PlatformPropertyTester extends PropertyTester { +public class PlatformPropertyTester extends PropertyTester +{ - /* (non-Javadoc) - * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + /* + * (non-Javadoc) + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], + * java.lang.Object) */ - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) + { if ("os".equals(property)) { //$NON-NLS-1$ return Platform.getOS().equals(String.valueOf(expectedValue)); - } else if ("ws".equals(property)) { //$NON-NLS-1$ + } + else if ("ws".equals(property)) { //$NON-NLS-1$ return Platform.getWS().equals(String.valueOf(expectedValue)); - } else if ("arch".equals(property)) { //$NON-NLS-1$ - return Platform.getOSArch().equals(String.valueOf(expectedValue)); + } + else if ("arch".equals(property)) { //$NON-NLS-1$ + return Platform.getOSArch().equals(String.valueOf(expectedValue)); } return false; } diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/platform/CoreNatives.java b/plugins/com.aptana.core/src/com/aptana/core/internal/platform/CoreNatives.java index ca76aadc16..842614ea24 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/platform/CoreNatives.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/platform/CoreNatives.java @@ -11,33 +11,32 @@ /** * @author Max Stepanov - * */ -public final class CoreNatives { +public final class CoreNatives +{ /** * Major version number (must be >= 0) */ - private static final int MAJOR_VERSION = 3; - + private static final int MAJOR_VERSION = 3; + /** * Minor version number (must be in the range 0..999) */ - private static final int MINOR_VERSION = 0; - + private static final int MINOR_VERSION = 0; + /** * release number (must be >= 0) */ private static final int RELEASE = 0; - /* Win32 */ - + /** * CSIDL_DESKTOPDIRECTORY */ public static final int CSIDL_DESKTOPDIRECTORY = 0x0010; - + /** * CSIDL_LOCAL_APPDATA */ @@ -52,7 +51,7 @@ public final class CoreNatives { * FILE_ATTRIBUTE_HIDDEN */ public static final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; - + /** * FILE_ATTRIBUTE_TEMPORARY */ @@ -86,79 +85,75 @@ public final class CoreNatives { public static final long HKEY_CURRENT_USER = 0x80000001; public static final long HKEY_LOCAL_MACHINE = 0x80000002; - public static final int KEY_QUERY_VALUE = 0x00000001; - public static final int KEY_SET_VALUE = 0x00000002; - public static final int KEY_CREATE_SUB_KEY = 0x00000004; - public static final int KEY_ENUMERATE_SUB_KEYS = 0x00000008; - public static final int KEY_READ = 0x00020019; - public static final int KEY_WRITE = 0x00020006; - public static final int KEY_ALL_ACCESS = 0x000F003F; - - static { - System.loadLibrary("core"+getVersionString()); //$NON-NLS-1$ + public static final int KEY_QUERY_VALUE = 0x00000001; + public static final int KEY_SET_VALUE = 0x00000002; + public static final int KEY_CREATE_SUB_KEY = 0x00000004; + public static final int KEY_ENUMERATE_SUB_KEYS = 0x00000008; + public static final int KEY_READ = 0x00020019; + public static final int KEY_WRITE = 0x00020006; + public static final int KEY_ALL_ACCESS = 0x000F003F; + + static + { + System.loadLibrary("core" + getVersionString()); //$NON-NLS-1$ } - - private CoreNatives() { + + private CoreNatives() + { } - + // CHECKSTYLE:OFF /** - * * GetProcessList - * + * * @return Object[] */ public static final native Object[] GetProcessList(); /** - * * GetCurrentProcessId - * + * * @return int */ public static final native int GetCurrentProcessId(); /** - * * KillProcess - * + * * @param pid */ public static final native void KillProcess(int pid); /** - * * GetSpecialFolderPath - * + * * @param csidl * @return String */ public static final native String GetSpecialFolderPath(int csidl); - + /** - * * SHObjectProperties - * + * * @param handle * @param type * @param object * @param page * @return boolean */ - public static final native boolean SHObjectProperties(int/*long*/ handle, int type, String object, String page); + public static final native boolean SHObjectProperties(int/* long */handle, int type, String object, String page); /** - * * ExpandEnvironmentStrings - * + * * @param path * @return String */ public static final native String ExpandEnvironmentStrings(String path); - + /** * SetFileAttributes - * + * * @param path * @param set * @param clear @@ -167,58 +162,50 @@ private CoreNatives() { public static final native boolean SetFileAttributes(String path, int set, int clear); /** + * RegOpenKey Open regestry key * - * RegOpenKey - * Open regestry key - * * @param hKeyParent * @param keyName * @param accessMask * @param hKeyResult * @return boolean */ - public static final native boolean RegOpenKey(long hKeyParent, String keyName, int accessMask, /*out*/long[] hKeyResult); + public static final native boolean RegOpenKey(long hKeyParent, String keyName, int accessMask, /* out */ + long[] hKeyResult); /** + * RegCreateKey Create regestry key * - * RegCreateKey - * Create regestry key - * * @param hKeyParent * @param keyName * @param accessMask * @param hKeyResult * @return boolean */ - public static final native boolean RegCreateKey(long hKeyParent, String keyName, int accessMask, /*out*/long[] hKeyResult); + public static final native boolean RegCreateKey(long hKeyParent, String keyName, int accessMask, /* out */ + long[] hKeyResult); /** + * RegCloseKey Close previously opened regestry key * - * RegCloseKey - * Close previously opened regestry key - * * @param hKey * @return boolean */ public static final native boolean RegCloseKey(long hKey); /** + * RegQueryValue Read value of regestry key * - * RegQueryValue - * Read value of regestry key - * * @param hKey * @param valueName * @param valueResult * @return boolean */ - public static final native boolean RegQueryValue(long hKey, String valueName, /*out*/String[] valueResult); + public static final native boolean RegQueryValue(long hKey, String valueName, /* out */String[] valueResult); /** + * RegSetValue Set value of regestry key * - * RegSetValue - * Set value of regestry key - * * @param hKey * @param valueName * @param value @@ -227,13 +214,13 @@ private CoreNatives() { public static final native boolean RegSetValue(long hKey, String valueName, String value); /** - * IsUserAnAdmin - * Tests whether the current user is a member of the Administrator's group. + * IsUserAnAdmin Tests whether the current user is a member of the Administrator's group. */ public static final native boolean IsUserAnAdmin(); - + /** * ShellExecuteEx + * * @param file * @param params * @param verb @@ -241,15 +228,14 @@ private CoreNatives() { * @param nShow * @return */ - public static final native boolean ShellExecuteEx(String file, String params, String verb, String directory, int nShow); + public static final native boolean ShellExecuteEx(String file, String params, String verb, String directory, + int nShow); + // CHECKSTYLE:ON - - - private static String getVersionString() { - return MessageFormat.format("_{0}_{1}_{2}", new Object[]{ //$NON-NLS-1$ - Integer.toString(MAJOR_VERSION), - Integer.toString(MINOR_VERSION), - Integer.toString(RELEASE) - }); + + private static String getVersionString() + { + return MessageFormat.format("_{0}_{1}_{2}", new Object[] { //$NON-NLS-1$ + Integer.toString(MAJOR_VERSION), Integer.toString(MINOR_VERSION), Integer.toString(RELEASE) }); } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerDelta.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerDelta.java index 8d7b707609..0f1b203c00 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerDelta.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerDelta.java @@ -17,20 +17,22 @@ * */ @SuppressWarnings("restriction") -public class MarkerDelta extends org.eclipse.core.internal.resources.MarkerDelta { +public class MarkerDelta extends org.eclipse.core.internal.resources.MarkerDelta +{ /** * uniform resource */ protected IUniformResource resource; - + public MarkerDelta(int kind, IUniformResource resource, MarkerInfo info) { super(kind, ResourcesPlugin.getWorkspace().getRoot(), info); this.resource = resource; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) * @see org.eclipse.core.internal.resources.MarkerDelta#isSubtypeOf(java.lang.String) */ public boolean isSubtypeOf(String superType) @@ -38,7 +40,8 @@ public boolean isSubtypeOf(String superType) return MarkerManager.getInstance().isSubtype(getType(), superType); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see org.eclipse.core.internal.resources.MarkerDelta#getMarker() */ public IMarker getMarker() @@ -48,14 +51,16 @@ public IMarker getMarker() /** * getUniformResource - * + * * @return IUniformResource */ - public IUniformResource getUniformResource() { + public IUniformResource getUniformResource() + { return resource; } - protected static MarkerSet merge(MarkerSet oldChanges, IMarkerSetElement[] newChanges) { + protected static MarkerSet merge(MarkerSet oldChanges, IMarkerSetElement[] newChanges) + { MarkerSet merged = new MarkerSet(); merged.addAll(org.eclipse.core.internal.resources.MarkerDelta.merge(oldChanges, newChanges).elements()); return merged; diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerInfo.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerInfo.java index fb4e17f8aa..e1445cb279 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerInfo.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerInfo.java @@ -16,49 +16,74 @@ * */ @SuppressWarnings({ "restriction", "rawtypes", "unchecked" }) -public class MarkerInfo extends org.eclipse.core.internal.resources.MarkerInfo { +public class MarkerInfo extends org.eclipse.core.internal.resources.MarkerInfo +{ /** UNDEFINED_ID */ protected static final long UNDEFINED_ID = org.eclipse.core.internal.resources.MarkerInfo.UNDEFINED_ID; - public void setAttributes(Map map, Boolean validate) { + public void setAttributes(Map map, Boolean validate) + { Class superClass = getClass().getSuperclass(); - try { - try { + try + { + try + { superClass.getMethod("setAttributes", Map.class).invoke(this, map); //$NON-NLS-1$ return; - } catch (NoSuchMethodException e) { + } + catch (NoSuchMethodException e) + { } superClass.getMethod("setAttributes", Map.class, boolean.class).invoke(this, map, validate); //$NON-NLS-1$ - } catch (Exception e) { + } + catch (Exception e) + { IdeLog.logError(CorePlugin.getDefault(), e); } } - public void setAttribute(String attributeName, Object value, Boolean validate) { + public void setAttribute(String attributeName, Object value, Boolean validate) + { Class superClass = getClass().getSuperclass(); - try { - try { + try + { + try + { superClass.getMethod("setAttribute", String.class, Object.class).invoke(this, attributeName, value); //$NON-NLS-1$ return; - } catch (NoSuchMethodException e) { } - superClass.getMethod("setAttribute", String.class, Object.class, boolean.class).invoke(this, attributeName, value, validate); //$NON-NLS-1$ - } catch (Exception e) { + catch (NoSuchMethodException e) + { + } + superClass + .getMethod("setAttribute", String.class, Object.class, boolean.class).invoke(this, attributeName, value, validate); //$NON-NLS-1$ + } + catch (Exception e) + { IdeLog.logError(CorePlugin.getDefault(), e); } } - public void setAttributes(String[] attributeNames, Object[] values, Boolean validate) { + public void setAttributes(String[] attributeNames, Object[] values, Boolean validate) + { Class superClass = getClass().getSuperclass(); - try { - try { - superClass.getMethod("setAttributes", String[].class, Object[].class).invoke(this, attributeNames, values); //$NON-NLS-1$ + try + { + try + { + superClass + .getMethod("setAttributes", String[].class, Object[].class).invoke(this, attributeNames, values); //$NON-NLS-1$ return; - } catch (NoSuchMethodException e) { } - superClass.getMethod("setAttributes", String[].class, Object[].class, boolean.class).invoke(this, attributeNames, values, validate); //$NON-NLS-1$ - } catch (Exception e) { + catch (NoSuchMethodException e) + { + } + superClass + .getMethod("setAttributes", String[].class, Object[].class, boolean.class).invoke(this, attributeNames, values, validate); //$NON-NLS-1$ + } + catch (Exception e) + { IdeLog.logError(CorePlugin.getDefault(), e); } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerSet.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerSet.java index 253772d646..57eee59926 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerSet.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/MarkerSet.java @@ -13,7 +13,8 @@ * */ @SuppressWarnings("restriction") -/*package*/ class MarkerSet extends org.eclipse.core.internal.resources.MarkerSet { +/* package */class MarkerSet extends org.eclipse.core.internal.resources.MarkerSet +{ /** * */ @@ -33,18 +34,21 @@ public MarkerSet(int capacity) /** * @see java.lang.Object#clone() */ - protected Object clone() { + protected Object clone() + { return super.clone(); } /** * copyInto - * + * * @param array */ - public void copyInto(Object[] array) { + public void copyInto(Object[] array) + { int j = 0; - for (int i = 0; i < elements.length; i++) { + for (int i = 0; i < elements.length; i++) + { IMarkerSetElement element = elements[i]; if (element != null) { diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/Messages.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/Messages.java index 2182eb9cba..99842462a8 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/Messages.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/Messages.java @@ -10,9 +10,7 @@ import org.eclipse.osgi.util.NLS; /** - * * @author Ingo Muschenetz - * */ public final class Messages extends NLS { @@ -27,12 +25,12 @@ private Messages() // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } - + /** * MarkerManager_MarkerIDIsDefined */ public static String MarkerManager_MarkerIDIsDefined; - + /** * UniformResourceMarker_UniformResourceMarketInfoNull */ diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/ResourceInfo.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/ResourceInfo.java index e3816810e1..391bb90765 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/ResourceInfo.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/ResourceInfo.java @@ -9,42 +9,45 @@ /** * @author Max Stepanov - * */ -/*package*/ class ResourceInfo { +/* package */class ResourceInfo +{ /** The collection of markers for this resource. */ private MarkerSet markers = null; - - /** - * Returns a copy of the collection of makers on this resource. - * null is returned if there are none. + /** + * Returns a copy of the collection of makers on this resource. null is returned if there are none. + * * @return MarkerSet */ - public MarkerSet getMarkers() { + public MarkerSet getMarkers() + { return getMarkers(true); } - /** - * Returns the collection of makers on this resource. - * null is returned if there are none. - * @param makeCopy + /** + * Returns the collection of makers on this resource. null is returned if there are none. + * + * @param makeCopy * @return MarkerSet */ - public MarkerSet getMarkers(boolean makeCopy) { - if (markers == null) { + public MarkerSet getMarkers(boolean makeCopy) + { + if (markers == null) + { return null; } return makeCopy ? (MarkerSet) markers.clone() : markers; } - /** - * Sets the collection of makers for this resource. - * null is passed in if there are no markers. - * @param value + /** + * Sets the collection of makers for this resource. null is passed in if there are no markers. + * + * @param value */ - public void setMarkers(MarkerSet value) { + public void setMarkers(MarkerSet value) + { markers = value; } diff --git a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/UniformResourceChangeEvent.java b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/UniformResourceChangeEvent.java index 9ab8525a1f..1f88a812b4 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/internal/resources/UniformResourceChangeEvent.java +++ b/plugins/com.aptana.core/src/com/aptana/core/internal/resources/UniformResourceChangeEvent.java @@ -17,13 +17,13 @@ /** * @author Max Stepanov - * */ -public class UniformResourceChangeEvent extends EventObject implements IUniformResourceChangeEvent { +public class UniformResourceChangeEvent extends EventObject implements IUniformResourceChangeEvent +{ private static final IMarkerDelta[] NO_MARKER_DELTAS = new IMarkerDelta[0]; private static final long serialVersionUID = 1L; - + private transient IUniformResource resource; private transient IMarkerDelta[] deltas; @@ -34,7 +34,8 @@ public class UniformResourceChangeEvent extends EventObject implements IUniformR * @param resource * @param deltas */ - public UniformResourceChangeEvent(Object source, IUniformResource resource, IMarkerDelta[] deltas) { + public UniformResourceChangeEvent(Object source, IUniformResource resource, IMarkerDelta[] deltas) + { super(source); this.resource = resource; this.deltas = deltas; @@ -43,17 +44,19 @@ public UniformResourceChangeEvent(Object source, IUniformResource resource, IMar /** * @see com.aptana.ide.core.resources.IUniformResourceChangeEvent#findMarkerDeltas(java.lang.String, boolean) */ - public IMarkerDelta[] findMarkerDeltas(String type, boolean includeSubtypes) { + public IMarkerDelta[] findMarkerDeltas(String type, boolean includeSubtypes) + { ArrayList matching = new ArrayList(); IMarkerDelta[] deltas = getMarkerDeltas(); - for( int i = 0; i < deltas.length; ++i ) { + for (int i = 0; i < deltas.length; ++i) + { IMarkerDelta markerDelta = deltas[i]; if (type == null || (includeSubtypes ? markerDelta.isSubtypeOf(type) : markerDelta.getType().equals(type))) { matching.add(markerDelta); } } - if ( matching.size() == 0 ) + if (matching.size() == 0) { return NO_MARKER_DELTAS; } @@ -63,15 +66,17 @@ public IMarkerDelta[] findMarkerDeltas(String type, boolean includeSubtypes) { /** * @see com.aptana.ide.core.resources.IUniformResourceChangeEvent#getResource() */ - public IUniformResource getResource() { + public IUniformResource getResource() + { return resource; } /** * @see com.aptana.ide.core.resources.IUniformResourceChangeEvent#getMarkerDeltas() */ - public IMarkerDelta[] getMarkerDeltas() { - if ( deltas == null ) + public IMarkerDelta[] getMarkerDeltas() + { + if (deltas == null) { return NO_MARKER_DELTAS; } diff --git a/plugins/com.aptana.core/src/com/aptana/core/logging/Messages.java b/plugins/com.aptana.core/src/com/aptana/core/logging/Messages.java index f660b60ca4..e9f9cdd296 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/logging/Messages.java +++ b/plugins/com.aptana.core/src/com/aptana/core/logging/Messages.java @@ -11,8 +11,8 @@ /** * Messages class for internationalization + * * @author Ingo Muschenetz - * */ public final class Messages extends NLS { @@ -27,7 +27,7 @@ private Messages() // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } - + public static String IdeLog_ERROR; public static String IdeLog_File_Written_To; diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/AbstractUniformResource.java b/plugins/com.aptana.core/src/com/aptana/core/resources/AbstractUniformResource.java index 44b76e2dc6..414cab5fb6 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/AbstractUniformResource.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/AbstractUniformResource.java @@ -11,28 +11,31 @@ /** * @author Max Stepanov - * */ -public abstract class AbstractUniformResource extends PlatformObject implements IUniformResource { +public abstract class AbstractUniformResource extends PlatformObject implements IUniformResource +{ /** * */ - protected AbstractUniformResource() { + protected AbstractUniformResource() + { super(); } /** * @see java.lang.Object#equals(java.lang.Object) */ - public boolean equals(Object obj) { - return obj instanceof IUniformResource && getURI().equals(((IUniformResource)obj).getURI()); + public boolean equals(Object obj) + { + return obj instanceof IUniformResource && getURI().equals(((IUniformResource) obj).getURI()); } /** * @see java.lang.Object#hashCode() */ - public int hashCode() { + public int hashCode() + { return getURI().hashCode(); } diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/FileStoreUniformResource.java b/plugins/com.aptana.core/src/com/aptana/core/resources/FileStoreUniformResource.java index 6e78a282ae..2d83d8db12 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/FileStoreUniformResource.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/FileStoreUniformResource.java @@ -14,24 +14,27 @@ /** * @author Max Stepanov - * */ -public final class FileStoreUniformResource extends AbstractUniformResource { +public final class FileStoreUniformResource extends AbstractUniformResource +{ private final IFileStore fileStore; - + /** * */ - public FileStoreUniformResource(IFileStore fileStore) { + public FileStoreUniformResource(IFileStore fileStore) + { super(); this.fileStore = fileStore; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.resources.IUniformResource#getURI() */ - public URI getURI() { + public URI getURI() + { return fileStore.toURI(); } diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/ISocketMessagesHandler.java b/plugins/com.aptana.core/src/com/aptana/core/resources/ISocketMessagesHandler.java index 81c32ca9ba..9231287f47 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/ISocketMessagesHandler.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/ISocketMessagesHandler.java @@ -12,7 +12,7 @@ /** * The interface to implement the handlers for addressing the requests/messages from the underlying CLI and return back * with the responses. - * + * * @author pinnamuri */ public interface ISocketMessagesHandler @@ -21,7 +21,7 @@ public interface ISocketMessagesHandler /** * Addresses the request either by prompting a UI to the user, or just computes a JSON object from existing answers, * and will return back a response. - * + * * @param request * @return */ diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResource.java b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResource.java index d668357776..aa88aac57a 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResource.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResource.java @@ -13,13 +13,13 @@ /** * @author Max Stepanov - * */ -public interface IUniformResource extends IAdaptable { - +public interface IUniformResource extends IAdaptable +{ + /** * Resource URI - * + * * @return URI */ URI getURI(); diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeEvent.java b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeEvent.java index 7049a4a183..3dfeda5982 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeEvent.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeEvent.java @@ -11,47 +11,46 @@ /** * @author Max Stepanov - * */ -public interface IUniformResourceChangeEvent { +public interface IUniformResourceChangeEvent +{ /** - * Returns the changes to markers on the corresponding resource. - * Returns an empty array if no markers changed. - * + * Returns the changes to markers on the corresponding resource. Returns an empty array if no markers changed. + * * @return the marker deltas */ IMarkerDelta[] getMarkerDeltas(); /** - * Returns all marker deltas of the specified type that are associated - * with resource deltas for this event. If includeSubtypes - * is false, only marker deltas whose type exactly matches - * the given type are returned. Returns an empty array if there - * are no matching marker deltas. + * Returns all marker deltas of the specified type that are associated with resource deltas for this event. If + * includeSubtypes is false, only marker deltas whose type exactly matches the given type + * are returned. Returns an empty array if there are no matching marker deltas. *

- * Calling this method is equivalent to walking the entire resource - * delta for this event, and collecting all marker deltas of a given type. - * The speed of this method will be proportional to the number of changed - * markers, regardless of the size of the resource delta tree. + * Calling this method is equivalent to walking the entire resource delta for this event, and collecting all marker + * deltas of a given type. The speed of this method will be proportional to the number of changed markers, + * regardless of the size of the resource delta tree. *

- * @param type the type of marker to consider, or null to indicate all types - * @param includeSubtypes whether or not to consider sub-types of the given type + * + * @param type + * the type of marker to consider, or null to indicate all types + * @param includeSubtypes + * whether or not to consider sub-types of the given type * @return an array of marker deltas */ IMarkerDelta[] findMarkerDeltas(String type, boolean includeSubtypes); - + /** * getResource - * + * * @return IUniformResource */ IUniformResource getResource(); /** * Returns an object identifying the source of this event. - * - * @return an object identifying the source of this event + * + * @return an object identifying the source of this event * @see java.util.EventObject */ Object getSource(); diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeListener.java b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeListener.java index e88aa77f09..604f6ddcbe 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeListener.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceChangeListener.java @@ -11,13 +11,13 @@ /** * @author Max Stepanov - * */ -public interface IUniformResourceChangeListener extends EventListener { +public interface IUniformResourceChangeListener extends EventListener +{ /** * resourceChanged - * + * * @param event */ void resourceChanged(IUniformResourceChangeEvent event); diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceMarker.java b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceMarker.java index 10bc1a7d38..9e9a05d4a0 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceMarker.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/IUniformResourceMarker.java @@ -11,12 +11,12 @@ /** * @author Max Stepanov - * */ -public interface IUniformResourceMarker extends IMarker { +public interface IUniformResourceMarker extends IMarker +{ /** * getUniformResource - * + * * @return IUniformResource */ IUniformResource getUniformResource(); diff --git a/plugins/com.aptana.core/src/com/aptana/core/resources/UniformResourceStorage.java b/plugins/com.aptana.core/src/com/aptana/core/resources/UniformResourceStorage.java index 7be7a50757..beaee437d5 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/resources/UniformResourceStorage.java +++ b/plugins/com.aptana.core/src/com/aptana/core/resources/UniformResourceStorage.java @@ -27,7 +27,8 @@ * @author Max Stepanov */ // TODO: rework using EFS -public abstract class UniformResourceStorage extends PlatformObject implements IStorage { +public abstract class UniformResourceStorage extends PlatformObject implements IStorage +{ private long timestamp = -1; private long expires = -1; @@ -35,7 +36,8 @@ public abstract class UniformResourceStorage extends PlatformObject implements I /** * UniformResourceStorage */ - protected UniformResourceStorage() { + protected UniformResourceStorage() + { super(); } @@ -50,18 +52,20 @@ protected UniformResourceStorage() { * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - if (IUniformResource.class == adapter) { - return new AbstractUniformResource() { + public Object getAdapter(Class adapter) + { + if (IUniformResource.class == adapter) + { + return new AbstractUniformResource() + { /* * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang - * .Class) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang .Class) */ - public Object getAdapter(Class adapter) { - if (IStorage.class == adapter) { + public Object getAdapter(Class adapter) + { + if (IStorage.class == adapter) + { return UniformResourceStorage.this; } return super.getAdapter(adapter); @@ -69,10 +73,10 @@ public Object getAdapter(Class adapter) { /* * (non-Javadoc) - * * @see com.aptana.ide.core.resources.IUniformResource#getURI() */ - public URI getURI() { + public URI getURI() + { return UniformResourceStorage.this.getURI(); } @@ -85,14 +89,16 @@ public URI getURI() { /** * @see java.lang.Object#equals(java.lang.Object) */ - public boolean equals(Object obj) { + public boolean equals(Object obj) + { return obj instanceof UniformResourceStorage && getURI().equals(((UniformResourceStorage) obj).getURI()); } /** * @see java.lang.Object#hashCode() */ - public int hashCode() { + public int hashCode() + { return getURI().hashCode(); } @@ -101,36 +107,49 @@ public int hashCode() { * * @return boolean */ - public boolean isValid() { - if (timestamp == -1) { + public boolean isValid() + { + if (timestamp == -1) + { return false; } - if (expires >= System.currentTimeMillis()) { + if (expires >= System.currentTimeMillis()) + { return true; } - try { + try + { URLConnection connection = getURI().toURL().openConnection(); - if (connection instanceof HttpURLConnection) { + if (connection instanceof HttpURLConnection) + { connection.setIfModifiedSince(timestamp); ((HttpURLConnection) connection).setRequestMethod("HEAD"); //$NON-NLS-1$ } connection.connect(); - if (connection instanceof HttpURLConnection) { + if (connection instanceof HttpURLConnection) + { HttpURLConnection httpConnection = (HttpURLConnection) connection; long lastModified = httpConnection.getLastModified(); - if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED || (lastModified != 0 && timestamp >= lastModified)) { + if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED + || (lastModified != 0 && timestamp >= lastModified)) + { expires = System.currentTimeMillis(); long expiration = connection.getExpiration(); long date = connection.getDate(); - if (expiration != 0 && date != 0 && expiration > date) { + if (expiration != 0 && date != 0 && expiration > date) + { expires += (expiration - date); - } else { + } + else + { expires += 10 * 1000; // 10 sec } return true; } } - } catch (IOException e) { + } + catch (IOException e) + { IdeLog.logError(CorePlugin.getDefault(), e); } return false; @@ -139,39 +158,53 @@ public boolean isValid() { /** * @see org.eclipse.core.resources.IStorage#getContents() */ - public InputStream getContents() throws CoreException { - try { + public InputStream getContents() throws CoreException + { + try + { URLConnection connection = getURI().toURL().openConnection(); connection.connect(); expires = System.currentTimeMillis(); long expiration = connection.getExpiration(); long date = connection.getDate(); - if (expiration != 0 && date != 0 && expiration > date) { + if (expiration != 0 && date != 0 && expiration > date) + { expires += (expiration - date); - } else { + } + else + { expires += 10 * 1000; // 10 sec } timestamp = connection.getLastModified(); return connection.getInputStream(); - } catch (IOException e) { + } + catch (IOException e) + { throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, IStatus.OK, "Open stream error", e)); //$NON-NLS-1$ } } - public boolean exists() { - try { + public boolean exists() + { + try + { URLConnection connection = getURI().toURL().openConnection(); - if (connection instanceof HttpURLConnection) { + if (connection instanceof HttpURLConnection) + { ((HttpURLConnection) connection).setRequestMethod("HEAD"); //$NON-NLS-1$ } connection.connect(); - if (connection instanceof HttpURLConnection) { + if (connection instanceof HttpURLConnection) + { HttpURLConnection httpConnection = (HttpURLConnection) connection; - if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { + if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) + { return true; } } - } catch (IOException e) { + } + catch (IOException e) + { IdeLog.logError(CorePlugin.getDefault(), e); } return false; @@ -180,18 +213,22 @@ public boolean exists() { /** * @see org.eclipse.core.resources.IStorage#getFullPath() */ - public IPath getFullPath() { + public IPath getFullPath() + { return null; } /** * @see org.eclipse.core.resources.IStorage#getName() */ - public String getName() { + public String getName() + { String name = getURI().getPath(); - if (name != null) { + if (name != null) + { int index = name.lastIndexOf('/'); - if (index >= 0) { + if (index >= 0) + { name = name.substring(index + 1); } } @@ -201,7 +238,8 @@ public String getName() { /** * @see org.eclipse.core.resources.IStorage#isReadOnly() */ - public boolean isReadOnly() { + public boolean isReadOnly() + { return true; } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/ExpiringMap.java b/plugins/com.aptana.core/src/com/aptana/core/util/ExpiringMap.java index e21c2b982a..1adeb9376c 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/ExpiringMap.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/ExpiringMap.java @@ -14,157 +14,194 @@ import java.util.Set; /** - * @author Max Stepanov - * TODO Merge/reuse IObjectPool? Very similar uses/implementations! + * @author Max Stepanov TODO Merge/reuse IObjectPool? Very similar uses/implementations! */ -public class ExpiringMap implements Map { +public class ExpiringMap implements Map +{ private LinkedHashMap map = new LinkedHashMap(); private long maxObjectTTL; - - public ExpiringMap(long maxObjectTTL) { + public ExpiringMap(long maxObjectTTL) + { super(); this.maxObjectTTL = maxObjectTTL; } - - private boolean hasExpired(Object key, Item item) { + + private boolean hasExpired(Object key, Item item) + { long now = System.currentTimeMillis(); - if (item.creationTime + maxObjectTTL < now) { + if (item.creationTime + maxObjectTTL < now) + { map.remove(key); return true; } return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#clear() */ - public void clear() { + public void clear() + { map.clear(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#containsKey(java.lang.Object) */ - public boolean containsKey(Object key) { + public boolean containsKey(Object key) + { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#containsValue(java.lang.Object) */ - public boolean containsValue(Object value) { + public boolean containsValue(Object value) + { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#entrySet() */ - public Set> entrySet() { + public Set> entrySet() + { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#get(java.lang.Object) */ - public V get(Object key) { + public V get(Object key) + { Item v = map.get(key); - if (v != null && !hasExpired(key, v)) { + if (v != null && !hasExpired(key, v)) + { return v.object; } return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#isEmpty() */ - public boolean isEmpty() { + public boolean isEmpty() + { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#keySet() */ - public Set keySet() { + public Set keySet() + { return map.keySet(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#put(java.lang.Object, java.lang.Object) */ - public V put(K key, V value) { - Item v = map.put(key, new Item(value)); - if (v != null) { + public V put(K key, V value) + { + Item v = map.put(key, new Item(value)); + if (v != null) + { return v.object; } return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#putAll(java.util.Map) */ - public void putAll(Map t) { + public void putAll(Map t) + { Map all = new LinkedHashMap(); - for (Entry i : t.entrySet()) { + for (Entry i : t.entrySet()) + { all.put(i.getKey(), new Item(i.getValue())); } map.putAll(all); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#remove(java.lang.Object) */ - public V remove(Object key) { + public V remove(Object key) + { Item v = map.remove(key); - if (v != null && !hasExpired(key, v)) { + if (v != null && !hasExpired(key, v)) + { return v.object; } return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#size() */ - public int size() { + public int size() + { throw new UnsupportedOperationException(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.util.Map#values() */ - public Collection values() { + public Collection values() + { throw new UnsupportedOperationException(); } - private class Item { - + private class Item + { + protected V object; protected long creationTime; - - public Item(V object) { + + public Item(V object) + { this.object = object; this.creationTime = System.currentTimeMillis(); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @SuppressWarnings("rawtypes") @Override - public boolean equals(Object obj) { - if (obj instanceof ExpiringMap.Item) { + public boolean equals(Object obj) + { + if (obj instanceof ExpiringMap.Item) + { return object == ((ExpiringMap.Item) obj).object - || (object != null && object.equals(((ExpiringMap.Item) obj).object)); + || (object != null && object.equals(((ExpiringMap.Item) obj).object)); } return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override - public int hashCode() { + public int hashCode() + { return object != null ? object.hashCode() : 0; } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/FileUtil.java b/plugins/com.aptana.core/src/com/aptana/core/util/FileUtil.java index 80044fb044..193ef46063 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/FileUtil.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/FileUtil.java @@ -224,7 +224,8 @@ public static boolean deleteRecursively(File dir) boolean result = true; if (dir.isDirectory()) { - // On *nix systems, defer to rm -rf. If for some reason it faiils, fall back to recursive delete via Java API + // On *nix systems, defer to rm -rf. If for some reason it faiils, fall back to recursive delete via Java + // API if (!PlatformUtil.isWindows()) { IStatus status = new ProcessRunner().runInBackground("/bin/rm", "-rf", dir.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/IObjectPool.java b/plugins/com.aptana.core/src/com/aptana/core/util/IObjectPool.java index 4bad8eaaa7..c8c23ab433 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/IObjectPool.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/IObjectPool.java @@ -7,7 +7,8 @@ */ package com.aptana.core.util; -public interface IObjectPool { +public interface IObjectPool +{ /** * Create a new instance of a managed object in the pool. diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/ImmutableTuple.java b/plugins/com.aptana.core/src/com/aptana/core/util/ImmutableTuple.java index 42c8f90040..f5da62eb3f 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/ImmutableTuple.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/ImmutableTuple.java @@ -85,7 +85,8 @@ public int hashCode() @Override public String toString() { - return StringUtil.concat("Tuple [", first != null ? first.toString() : "null", " -- ", second != null ? second.toString() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - : "null", "]"); //$NON-NLS-1$//$NON-NLS-2$ + return StringUtil.concat( + "Tuple [", first != null ? first.toString() : "null", " -- ", second != null ? second.toString() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + : "null", "]"); //$NON-NLS-1$//$NON-NLS-2$ } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/KeepAliveObjectPool.java b/plugins/com.aptana.core/src/com/aptana/core/util/KeepAliveObjectPool.java index fea8ab0e54..8240ade76c 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/KeepAliveObjectPool.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/KeepAliveObjectPool.java @@ -16,14 +16,16 @@ import com.aptana.core.CorePlugin; import com.aptana.core.logging.IdeLog; -public abstract class KeepAliveObjectPool implements IObjectPool { +public abstract class KeepAliveObjectPool implements IObjectPool +{ private final List locked; private final Map unlocked; private final ConnectionReaper reaper; private final int releaseTime; - public KeepAliveObjectPool(int releaseTime) { + public KeepAliveObjectPool(int releaseTime) + { this.releaseTime = releaseTime; locked = new ArrayList(); unlocked = new LinkedHashMap(); @@ -31,19 +33,24 @@ public KeepAliveObjectPool(int releaseTime) { reaper = new ConnectionReaper(); } - protected void start() { + protected void start() + { reaper.start(); } - public synchronized void checkIn(T t) { + public synchronized void checkIn(T t) + { locked.remove(t); unlocked.put(t, System.currentTimeMillis()); } - public synchronized T checkOut() { + public synchronized T checkOut() + { // returns the first valid connection from the unused queue - for (T c : unlocked.keySet()) { - if (validate(c)) { + for (T c : unlocked.keySet()) + { + if (validate(c)) + { unlocked.remove(c); locked.add(c); return c; @@ -56,30 +63,38 @@ public synchronized T checkOut() { return c; } - public synchronized void dispose() { - for (T c : unlocked.keySet()) { + public synchronized void dispose() + { + for (T c : unlocked.keySet()) + { expire(c); } unlocked.clear(); - if (locked.size() > 0) { + if (locked.size() > 0) + { IdeLog.logWarning(CorePlugin.getDefault(), - MessageFormat.format( - "Killed a connection pool that still has {0} locked items", locked.size())); //$NON-NLS-1$ + MessageFormat.format("Killed a connection pool that still has {0} locked items", locked.size())); //$NON-NLS-1$ locked.clear(); } reaper.exit(); } - protected synchronized void reap() { + protected synchronized void reap() + { long now = System.currentTimeMillis(); - for (T c : unlocked.keySet()) { - if ((now - unlocked.get(c)) > timeToRelease()) { + for (T c : unlocked.keySet()) + { + if ((now - unlocked.get(c)) > timeToRelease()) + { // time to release the connection unlocked.remove(c); expire(c); - } else { + } + else + { // keeps the connection alive unless it no longer validates - if (!validate(c)) { + if (!validate(c)) + { unlocked.remove(c); expire(c); } @@ -87,32 +102,41 @@ protected synchronized void reap() { } } - private int timeToRelease() { + private int timeToRelease() + { int divider = ((unlocked.size() + locked.size()) ^ 2); return releaseTime / (divider > 0 ? divider : 1); } - private class ConnectionReaper extends Thread { + private class ConnectionReaper extends Thread + { private static final long INTERVAL = 15000; // 15 seconds private boolean isRunning; - public ConnectionReaper() { + public ConnectionReaper() + { isRunning = true; } - public void run() { - while (isRunning) { - try { + public void run() + { + while (isRunning) + { + try + { sleep(INTERVAL); - } catch (InterruptedException e) { + } + catch (InterruptedException e) + { } reap(); } } - public void exit() { + public void exit() + { isRunning = false; } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/ObjectPool.java b/plugins/com.aptana.core/src/com/aptana/core/util/ObjectPool.java index 27d264bd6f..7fb77d1170 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/ObjectPool.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/ObjectPool.java @@ -38,22 +38,26 @@ public ObjectPool() this(DEFAULT_EXPIRATION); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#create() */ public abstract T create(); - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#validate(T) */ public abstract boolean validate(T o); - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#expire(T) */ public abstract void expire(T o); - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#checkOut() */ public synchronized T checkOut() @@ -98,7 +102,8 @@ public synchronized T checkOut() return t; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#checkIn(T) */ public synchronized void checkIn(T t) @@ -107,7 +112,8 @@ public synchronized void checkIn(T t) unlocked.put(t, System.currentTimeMillis()); } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see com.aptana.core.util.IObjectPool#cleanup() */ public synchronized void dispose() diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/ProcessRunner.java b/plugins/com.aptana.core/src/com/aptana/core/util/ProcessRunner.java index 1dac7d3b03..5dd7a70fea 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/ProcessRunner.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/ProcessRunner.java @@ -271,7 +271,8 @@ public IStatus runInBackground(IPath workingDirectory, Map envir } else { - CollectionsUtil.addToList(arguments, ">", outFile.getAbsolutePath(), "2>", errFile.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ + CollectionsUtil.addToList(arguments, + ">", outFile.getAbsolutePath(), "2>", errFile.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ p = run(workingDirectory, environment, arguments.toArray(new String[arguments.size()])); } return processData(p, outFile, errFile); diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/ProgressMonitorInterrupter.java b/plugins/com.aptana.core/src/com/aptana/core/util/ProgressMonitorInterrupter.java index 986ba582ac..b4a1db13f1 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/ProgressMonitorInterrupter.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/ProgressMonitorInterrupter.java @@ -23,9 +23,11 @@ * * @author Max Stepanov */ -public class ProgressMonitorInterrupter { +public class ProgressMonitorInterrupter +{ - public interface InterruptDelegate { + public interface InterruptDelegate + { public void interrupt(); } @@ -35,61 +37,81 @@ public interface InterruptDelegate { private final Thread thread; private final MonitorThread monitorThread; - private static Map delegates = Collections.synchronizedMap(new WeakHashMap()); + private static Map delegates = Collections + .synchronizedMap(new WeakHashMap()); /** * */ - public ProgressMonitorInterrupter(IProgressMonitor monitor) { + public ProgressMonitorInterrupter(IProgressMonitor monitor) + { this.monitor = monitor != null ? monitor : new NullProgressMonitor(); this.thread = Thread.currentThread(); monitorThread = new MonitorThread(); monitorThread.start(); } - public void dispose() { + public void dispose() + { monitorThread.interrupt(); } /** * Sets interrupt delegate for the current thread + * * @param delegate */ - public static void setCurrentThreadInterruptDelegate(InterruptDelegate delegate) { - if (delegate != null) { + public static void setCurrentThreadInterruptDelegate(InterruptDelegate delegate) + { + if (delegate != null) + { delegates.put(Thread.currentThread(), delegate); - } else { + } + else + { delegates.remove(Thread.currentThread()); } } - private static void interruptThread(Thread thread) { + private static void interruptThread(Thread thread) + { InterruptDelegate delegate = delegates.get(thread); - if (delegate != null) { + if (delegate != null) + { delegate.interrupt(); - } else { + } + else + { thread.interrupt(); } } - private class MonitorThread extends Thread { + private class MonitorThread extends Thread + { - public MonitorThread() { + public MonitorThread() + { super("Progress Monitor Thread"); //$NON-NLS-1$ setDaemon(true); } @Override - public void run() { - try { - while (!interrupted()) { - if (monitor.isCanceled()) { + public void run() + { + try + { + while (!interrupted()) + { + if (monitor.isCanceled()) + { interruptThread(thread); break; } sleep(CHECK_INTERVAL); } - } catch (InterruptedException e) { + } + catch (InterruptedException e) + { Thread.currentThread().interrupt(); } } diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/SourcePrinter.java b/plugins/com.aptana.core/src/com/aptana/core/util/SourcePrinter.java index 71c196d1f3..bed0c89231 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/SourcePrinter.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/SourcePrinter.java @@ -39,7 +39,7 @@ public SourcePrinter(String indent) this._currentIndent = StringUtil.EMPTY; this._newLine = DEFAULT_NEWLINE; } - + /** * Decrease the current line indent count * diff --git a/plugins/com.aptana.core/src/com/aptana/core/util/TimeZoneUtil.java b/plugins/com.aptana.core/src/com/aptana/core/util/TimeZoneUtil.java index 935b07ac6b..94cfc67167 100644 --- a/plugins/com.aptana.core/src/com/aptana/core/util/TimeZoneUtil.java +++ b/plugins/com.aptana.core/src/com/aptana/core/util/TimeZoneUtil.java @@ -14,11 +14,13 @@ /** * @author Max Stepanov */ -public final class TimeZoneUtil { +public final class TimeZoneUtil +{ private static final List commonTimeZones = new ArrayList(); - static { + static + { commonTimeZones.add("EST"); //$NON-NLS-1$ commonTimeZones.add("CST"); //$NON-NLS-1$ commonTimeZones.add("MST"); //$NON-NLS-1$ @@ -29,25 +31,32 @@ public final class TimeZoneUtil { /** * */ - private TimeZoneUtil() { + private TimeZoneUtil() + { } - public static String getCommonTimeZone(String[] timezones) { - if (timezones == null || timezones.length == 0) { + public static String getCommonTimeZone(String[] timezones) + { + if (timezones == null || timezones.length == 0) + { return StringUtil.EMPTY; } - for (String i : timezones) { - if (commonTimeZones.contains(i)) { + for (String i : timezones) + { + if (commonTimeZones.contains(i)) + { return i; } } - for (String i : timezones) { + for (String i : timezones) + { if (i.startsWith("GMT")) { //$NON-NLS-1$ return i; } } - for (String i : timezones) { + for (String i : timezones) + { if (i.startsWith("Etc/GMT")) { //$NON-NLS-1$ return i; }