diff options
author | Xavier Ducrohet <xav@android.com> | 2009-05-13 16:46:31 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2009-05-13 16:46:31 -0700 |
commit | 2cbd4af191586dedcb05e5ade868ba5bab848ad3 (patch) | |
tree | 6f6d5d833d3d5e42dea111cd1dc6d4b06e0695da /eclipse | |
parent | 85211cd176c655f245e46b753926089adaf2a6fd (diff) | |
download | sdk-2cbd4af191586dedcb05e5ade868ba5bab848ad3.zip sdk-2cbd4af191586dedcb05e5ade868ba5bab848ad3.tar.gz sdk-2cbd4af191586dedcb05e5ade868ba5bab848ad3.tar.bz2 |
ADT: Remove StreamHelper and integrate it in AdtPlugin.
StreamHelper was used before by AdtPlugin, DdmsPlugin and EditorsPlugin. It's now
only used by AdtPlugin, so the only 2 methods in it can go in AdtPlugin.
I merged the externalized string in the messages.properties file used by AdtPlugin.
Diffstat (limited to 'eclipse')
7 files changed, 117 insertions, 162 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF index 0be8c38..51616f5 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF +++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF @@ -54,7 +54,6 @@ Export-Package: com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse. com.android.ide.eclipse.adt.sdk;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.wizards.newproject;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.ui;x-friends:="com.android.ide.eclipse.tests", - com.android.ide.eclipse.common;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.common.project;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.common.resources;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.editors;x-friends:="com.android.ide.eclipse.tests", diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index 207dd88..697cf5b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -30,7 +30,6 @@ import com.android.ide.eclipse.adt.sdk.LoadStatus; import com.android.ide.eclipse.adt.sdk.Sdk; import com.android.ide.eclipse.adt.sdk.Sdk.ITargetChangeListener; import com.android.ide.eclipse.adt.ui.EclipseUiHelper; -import com.android.ide.eclipse.common.StreamHelper; import com.android.ide.eclipse.common.project.BaseProjectHelper; import com.android.ide.eclipse.common.project.ExportHelper; import com.android.ide.eclipse.common.project.ExportHelper.IExportCallback; @@ -109,6 +108,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.List; /** @@ -117,7 +117,7 @@ import java.util.List; public class AdtPlugin extends AbstractUIPlugin { /** The plug-in ID */ public static final String PLUGIN_ID = "com.android.ide.eclipse.adt"; //$NON-NLS-1$ - + public final static String PREFS_SDK_DIR = PLUGIN_ID + ".sdk"; //$NON-NLS-1$ public final static String PREFS_RES_AUTO_REFRESH = PLUGIN_ID + ".resAutoRefresh"; //$NON-NLS-1$ @@ -131,7 +131,7 @@ public class AdtPlugin extends AbstractUIPlugin { public final static String PREFS_HOME_PACKAGE = PLUGIN_ID + ".homePackage"; //$NON-NLS-1$ public final static String PREFS_EMU_OPTIONS = PLUGIN_ID + ".emuOptions"; //$NON-NLS-1$ - + /** singleton instance */ private static AdtPlugin sPlugin; @@ -161,7 +161,7 @@ public class AdtPlugin extends AbstractUIPlugin { /** Color used in the error console */ private Color mRed; - + /** Load status of the SDK. Any access MUST be in a synchronized(mPostLoadProjects) block */ private LoadStatus mSdkIsLoaded = LoadStatus.LOADING; /** Project to update once the SDK is loaded. @@ -171,7 +171,7 @@ public class AdtPlugin extends AbstractUIPlugin { /** Project to check validity of cache vs actual once the SDK is loaded. * Any access MUST be in a synchronized(mPostLoadProjectsToResolve) block */ private final ArrayList<IJavaProject> mPostLoadProjectsToCheck = new ArrayList<IJavaProject>(); - + private ResourceMonitor mResourceMonitor; private ArrayList<ITargetChangeListener> mTargetChangeListeners = new ArrayList<ITargetChangeListener>(); @@ -203,7 +203,7 @@ public class AdtPlugin extends AbstractUIPlugin { @Override public void println(String message) { // write the date/project tag first. - String tag = StreamHelper.getMessageTag(mProject != null ? mProject.getName() : null); + String tag = getMessageTag(mProject != null ? mProject.getName() : null); print(tag); if (mPrefix != null) { @@ -311,7 +311,7 @@ public class AdtPlugin extends AbstractUIPlugin { // get the SDK location and build id. if (checkSdkLocationAndId()) { // if sdk if valid, reparse it - + // add all the opened Android projects to the list of projects to be updated // after the SDK is reloaded synchronized (getSdkLockObject()) { @@ -319,7 +319,7 @@ public class AdtPlugin extends AbstractUIPlugin { IJavaProject[] androidProjects = BaseProjectHelper.getAndroidProjects(); mPostLoadProjectsToResolve.addAll(Arrays.asList(androidProjects)); } - + // parse the SDK resources at the new location parseSdkContent(); } @@ -340,7 +340,7 @@ public class AdtPlugin extends AbstractUIPlugin { // check the location of SDK final boolean isSdkLocationValid = checkSdkLocationAndId(); - + mBuildVerbosity = BuildPreferencePage.getBuildLevel( mStore.getString(PREFS_BUILD_VERBOSITY)); @@ -355,7 +355,7 @@ public class AdtPlugin extends AbstractUIPlugin { // and give it the debug launcher for android projects DdmsPlugin.setRunningAppDebugLauncher(new DdmsPlugin.IDebugLauncher() { public boolean debug(String appName, int port) { - // search for an android project matching the process name + // search for an android project matching the process name IProject project = ProjectHelper.findAndroidProjectByAppName(appName); if (project != null) { AndroidLaunchController.debugRunningApp(project, port); @@ -365,7 +365,7 @@ public class AdtPlugin extends AbstractUIPlugin { } } }); - + StackTracePanel.setSourceRevealer(new ISourceRevealer() { public void reveal(String applicationName, String className, int line) { IProject project = ProjectHelper.findAndroidProjectByAppName(applicationName); @@ -374,12 +374,12 @@ public class AdtPlugin extends AbstractUIPlugin { } } }); - + // setup export callback for editors ExportHelper.setCallback(new IExportCallback() { public void startExportWizard(IProject project) { StructuredSelection selection = new StructuredSelection(project); - + ExportWizard wizard = new ExportWizard(); wizard.init(PlatformUI.getWorkbench(), selection); WizardDialog dialog = new WizardDialog(getDisplay().getActiveShell(), @@ -387,7 +387,7 @@ public class AdtPlugin extends AbstractUIPlugin { dialog.open(); } }); - + // initialize editors startEditors(); @@ -399,16 +399,16 @@ public class AdtPlugin extends AbstractUIPlugin { @Override public void done(IJobChangeEvent event) { super.done(event); - + // Once the ping job is finished, start the SDK parser if (isSdkLocationValid) { // parse the SDK resources. parseSdkContent(); } - } + } }); // build jobs are run after other interactive jobs - pingJob.setPriority(Job.BUILD); + pingJob.setPriority(Job.BUILD); // Wait 2 seconds before starting the ping job. This leaves some time to the // other bundles to initialize. pingJob.schedule(2000 /*milliseconds*/); @@ -416,15 +416,15 @@ public class AdtPlugin extends AbstractUIPlugin { /* * (non-Javadoc) - * + * * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ @Override public void stop(BundleContext context) throws Exception { super.stop(context); - + stopEditors(); - + mRed.dispose(); synchronized (AdtPlugin.class) { sPlugin = null; @@ -524,7 +524,7 @@ public class AdtPlugin extends AbstractUIPlugin { if (sPlugin != null) { return sPlugin.mBuildVerbosity; } - + return 0; } @@ -536,7 +536,7 @@ public class AdtPlugin extends AbstractUIPlugin { * @return the image descriptor */ public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); + return imageDescriptorFromPlugin(PLUGIN_ID, path); } /** @@ -554,7 +554,7 @@ public class AdtPlugin extends AbstractUIPlugin { return null; } } - + // attempt to get a file to one of the template. try { URL url = bundle.getEntry(AndroidConstants.WS_SEP + filepath); @@ -682,10 +682,10 @@ public class AdtPlugin extends AbstractUIPlugin { }); return result[0]; } - + /** * Logs a message to the default Eclipse log. - * + * * @param severity The severity code. Valid values are: {@link IStatus#OK}, * {@link IStatus#ERROR}, {@link IStatus#INFO}, {@link IStatus#WARNING} or * {@link IStatus#CANCEL}. @@ -703,7 +703,7 @@ public class AdtPlugin extends AbstractUIPlugin { * Logs an exception to the default Eclipse log. * <p/> * The status severity is always set to ERROR. - * + * * @param exception the exception to log. * @param format The format string, like for {@link String#format(String, Object...)}. * @param args The arguments for the format string, like for @@ -714,13 +714,13 @@ public class AdtPlugin extends AbstractUIPlugin { Status status = new Status(IStatus.ERROR, PLUGIN_ID, message, exception); getDefault().getLog().log(status); } - + /** * This is a mix between log(Throwable) and printErrorToConsole. * <p/> * This logs the exception with an ERROR severity and the given printf-like format message. * The same message is then printed on the Android error console with the associated tag. - * + * * @param exception the exception to log. * @param format The format string, like for {@link String#format(String, Object...)}. * @param args The arguments for the format string, like for @@ -732,7 +732,7 @@ public class AdtPlugin extends AbstractUIPlugin { String message = String.format(format, args); Status status = new Status(IStatus.ERROR, PLUGIN_ID, message, exception); getDefault().getLog().log(status); - StreamHelper.printToStream(sPlugin.mAndroidConsoleErrorStream, tag, message); + printToStream(sPlugin.mAndroidConsoleErrorStream, tag, message); showAndroidConsole(); } } @@ -744,8 +744,8 @@ public class AdtPlugin extends AbstractUIPlugin { */ public static synchronized void printErrorToConsole(String tag, Object... objects) { if (sPlugin != null) { - StreamHelper.printToStream(sPlugin.mAndroidConsoleErrorStream, tag, objects); - + printToStream(sPlugin.mAndroidConsoleErrorStream, tag, objects); + showAndroidConsole(); } } @@ -782,7 +782,7 @@ public class AdtPlugin extends AbstractUIPlugin { if (sPlugin != null) { if (level <= sPlugin.mBuildVerbosity) { String tag = project != null ? project.getName() : null; - StreamHelper.printToStream(sPlugin.mAndroidConsoleStream, tag, objects); + printToStream(sPlugin.mAndroidConsoleStream, tag, objects); } } } @@ -794,7 +794,7 @@ public class AdtPlugin extends AbstractUIPlugin { */ public static synchronized void printToConsole(String tag, Object... objects) { if (sPlugin != null) { - StreamHelper.printToStream(sPlugin.mAndroidConsoleStream, tag, objects); + printToStream(sPlugin.mAndroidConsoleStream, tag, objects); } } @@ -812,7 +812,7 @@ public class AdtPlugin extends AbstractUIPlugin { public static void showAndroidConsole() { // first make sure the console is in the workbench EclipseUiHelper.showView(IConsoleConstants.ID_CONSOLE_VIEW, true); - + // now make sure it's not docked. ConsolePlugin.getDefault().getConsoleManager().showConsoleView( AdtPlugin.getDefault().getAndroidConsole()); @@ -831,7 +831,7 @@ public class AdtPlugin extends AbstractUIPlugin { if (sPlugin != null) { return new AndroidPrintStream(project, prefix, sPlugin.mAndroidConsoleStream); } - + return null; } @@ -848,10 +848,10 @@ public class AdtPlugin extends AbstractUIPlugin { if (sPlugin != null) { return new AndroidPrintStream(project, prefix, sPlugin.mAndroidConsoleErrorStream); } - + return null; } - + /** * Returns whether the Sdk has been loaded. */ @@ -860,7 +860,7 @@ public class AdtPlugin extends AbstractUIPlugin { return mSdkIsLoaded; } } - + /** * Returns the lock object for SDK loading. If you wish to do things while the SDK is loading, * you must synchronize on this object. @@ -868,7 +868,7 @@ public class AdtPlugin extends AbstractUIPlugin { public final Object getSdkLockObject() { return mPostLoadProjectsToResolve; } - + /** * Sets the given {@link IJavaProject} to have its target resolved again once the SDK finishes * to load. @@ -878,14 +878,14 @@ public class AdtPlugin extends AbstractUIPlugin { mPostLoadProjectsToResolve.add(javaProject); } } - + /** * Sets the given {@link IJavaProject} to have its target checked for consistency * once the SDK finishes to load. This is used if the target is resolved using cached * information while the SDK is loading. */ public final void setProjectToCheck(IJavaProject javaProject) { - // only lock on + // only lock on synchronized (getSdkLockObject()) { mPostLoadProjectsToCheck.add(javaProject); } @@ -983,7 +983,7 @@ public class AdtPlugin extends AbstractUIPlugin { protected IStatus run(IProgressMonitor monitor) { try { pingUsageServer(); //$NON-NLS-1$ - + return Status.OK_STATUS; } catch (Throwable t) { log(t, "pingUsageServer failed"); //$NON-NLS-1$ @@ -994,7 +994,7 @@ public class AdtPlugin extends AbstractUIPlugin { }; return job; } - + /** * Parses the SDK resources. */ @@ -1011,18 +1011,18 @@ public class AdtPlugin extends AbstractUIPlugin { return new Status(IStatus.WARNING, PLUGIN_ID, "An Android SDK is already being loaded. Please try again later."); } - + mSdkIsLoading = true; - + SubMonitor progress = SubMonitor.convert(monitor, "Initialize SDK Manager", 100); - + Sdk sdk = Sdk.loadSdk(mOsSdkLocation); - + if (sdk != null) { - + progress.setTaskName(Messages.AdtPlugin_Parsing_Resources); - + int n = sdk.getTargets().length; if (n > 0) { int w = 60 / n; @@ -1043,7 +1043,7 @@ public class AdtPlugin extends AbstractUIPlugin { mSdkIsLoaded = LoadStatus.LOADED; progress.setTaskName("Check Projects"); - + ArrayList<IJavaProject> list = new ArrayList<IJavaProject>(); for (IJavaProject javaProject : mPostLoadProjectsToResolve) { if (javaProject.getProject().isOpen()) { @@ -1059,24 +1059,24 @@ public class AdtPlugin extends AbstractUIPlugin { // do not need to be resolved again). AndroidClasspathContainerInitializer.checkProjectsCache( mPostLoadProjectsToCheck); - + list.addAll(mPostLoadProjectsToCheck); - + // update the project that needs recompiling. if (list.size() > 0) { IJavaProject[] array = list.toArray( new IJavaProject[list.size()]); AndroidClasspathContainerInitializer.updateProjects(array); } - + progress.worked(10); } } - + // Notify resource changed listeners progress.setTaskName("Refresh UI"); progress.setWorkRemaining(mTargetChangeListeners.size()); - + // Clone the list before iterating, to avoid Concurrent Modification // exceptions final List<ITargetChangeListener> listeners = @@ -1108,19 +1108,19 @@ public class AdtPlugin extends AbstractUIPlugin { job.setPriority(Job.BUILD); // build jobs are run after other interactive jobs job.schedule(); } - + /** Returns the global android console */ public MessageConsole getAndroidConsole() { return mAndroidConsole; } - + // ----- Methods for Editors ------- public void startEditors() { sAndroidLogoDesc = imageDescriptorFromPlugin(AdtPlugin.PLUGIN_ID, "/icons/android.png"); //$NON-NLS-1$ sAndroidLogo = sAndroidLogoDesc.createImage(); - + // get the stream to write in the android console. MessageConsole androidConsole = AdtPlugin.getDefault().getAndroidConsole(); mAndroidConsoleStream = androidConsole.newMessageStream(); @@ -1153,19 +1153,19 @@ public class AdtPlugin extends AbstractUIPlugin { /** * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code> - * method saves this plug-in's preference and dialog stores and shuts down + * method saves this plug-in's preference and dialog stores and shuts down * its image registry (if they are in use). Subclasses may extend this * method, but must send super <b>last</b>. A try-finally statement should * be used where necessary to ensure that <code>super.shutdown()</code> is * always done. - * + * * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ public void stopEditors() { sAndroidLogo.dispose(); - + IconFactory.getInstance().Dispose(); - + // Remove the resource listener that handles compiled resources. IWorkspace ws = ResourcesPlugin.getWorkspace(); ResourceMonitor.stopMonitoring(ws); @@ -1175,7 +1175,7 @@ public class AdtPlugin extends AbstractUIPlugin { /** * Returns an Image for the small Android logo. - * + * * Callers should not dispose it. */ public static Image getAndroidLogo() { @@ -1184,13 +1184,13 @@ public class AdtPlugin extends AbstractUIPlugin { /** * Returns an {@link ImageDescriptor} for the small Android logo. - * + * * Callers should not dispose it. */ public static ImageDescriptor getAndroidLogoDesc() { return sAndroidLogoDesc; } - + /** * Returns the ResourceMonitor object. */ @@ -1200,23 +1200,23 @@ public class AdtPlugin extends AbstractUIPlugin { /** * Sets up the editor to register default editors for resource files when needed. - * + * * This is called by the {@link AdtPlugin} during initialization. - * + * * @param monitor The main Resource Monitor object. */ public void setupDefaultEditor(ResourceMonitor monitor) { monitor.addFileListener(new IFileListener() { private static final String UNKNOWN_EDITOR = "unknown-editor"; //$NON-NLS-1$ - + /* (non-Javadoc) * Sent when a file changed. * @param file The file that changed. * @param markerDeltas The marker deltas for the file. * @param kind The change kind. This is equivalent to * {@link IResourceDelta#accept(IResourceDeltaVisitor)} - * + * * @see IFileListener#fileChanged */ public void fileChanged(IFile file, IMarkerDelta[] markerDeltas, int kind) { @@ -1226,7 +1226,7 @@ public class AdtPlugin extends AbstractUIPlugin { // There is no support for sub folders, so the segment count must be 4 if (file.getFullPath().segmentCount() == 4) { // check if we are inside the res folder. - String segment = file.getFullPath().segment(1); + String segment = file.getFullPath().segment(1); if (segment.equalsIgnoreCase(SdkConstants.FD_RESOURCES)) { // we are inside a res/ folder, get the actual ResourceFolder ProjectResources resources = ResourceManager.getInstance(). @@ -1245,7 +1245,7 @@ public class AdtPlugin extends AbstractUIPlugin { ResourceFolder resFolder = resources.getResourceFolder( (IFolder)file.getParent()); - + if (resFolder != null) { if (kind == IResourceDelta.ADDED) { resourceAdded(file, resFolder.getType()); @@ -1313,7 +1313,7 @@ public class AdtPlugin extends AbstractUIPlugin { file.setPersistentProperty(qname, null); IWorkbenchPage page = PlatformUI.getWorkbench(). getActiveWorkbenchWindow().getActivePage(); - + IEditorPart oldEditor = page.findEditor(new FileEditorInput(file)); if (oldEditor != null && AdtPlugin.displayPrompt("Android XML Editor", @@ -1325,7 +1325,7 @@ public class AdtPlugin extends AbstractUIPlugin { XmlEditor.ID, true, /* activate */ IWorkbenchPage.MATCH_NONE); - + if (newEditor != null) { page.closeEditor(oldEditor, true /* save */); } @@ -1378,7 +1378,7 @@ public class AdtPlugin extends AbstractUIPlugin { } }); } - + public static synchronized OutputStream getErrorStream() { return sPlugin.mAndroidConsoleErrorStream; } @@ -1398,4 +1398,40 @@ public class AdtPlugin extends AbstractUIPlugin { SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$ } + /** + * Prints messages, associated with a project to the specified stream + * @param stream The stream to write to + * @param tag The tag associated to the message. Can be null + * @param objects The objects to print through their toString() method (or directly for + * {@link String} objects. + */ + public static synchronized void printToStream(MessageConsoleStream stream, String tag, + Object... objects) { + String dateTag = getMessageTag(tag); + + for (Object obj : objects) { + stream.print(dateTag); + if (obj instanceof String) { + stream.println((String)obj); + } else { + stream.println(obj.toString()); + } + } + } + + /** + * Creates a string containing the current date/time, and the tag + * @param tag The tag associated to the message. Can be null + * @return The dateTag + */ + public static String getMessageTag(String tag) { + Calendar c = Calendar.getInstance(); + + if (tag == null) { + return String.format(Messages.Console_Date_Tag, c); + } + + return String.format(Messages.Console_Data_Project_Tag, c, tag); + } + } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java index a638810..33046dc 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java @@ -16,6 +16,10 @@ public class Messages extends NLS { public static String AdtPlugin_Parsing_Resources; + public static String Console_Data_Project_Tag; + + public static String Console_Date_Tag; + public static String Could_Not_Find; public static String Could_Not_Find_Folder; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties index dfb0eb2..982bd84 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties @@ -13,4 +13,6 @@ AdtPlugin_Failed_To_Start_s=Failed to start %1$s AdtPlugin_Android_SDK_Content_Loader=Android SDK Content Loader AdtPlugin_Parsing_Resources=Parsing Resources AdtPlugin_Android_SDK_Resource_Parser=Android SDK Resource Parser -AdtPlugin_Failed_To_Parse_s=Failed to parse: +AdtPlugin_Failed_To_Parse_s=Failed to parse: +Console_Date_Tag=[%1$tF %1$tT] +Console_Data_Project_Tag=[%1$tF %1$tT - %2$s] diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/Messages.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/Messages.java deleted file mode 100644 index 3f1bde4..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/Messages.java +++ /dev/null @@ -1,21 +0,0 @@ - -package com.android.ide.eclipse.common; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "com.android.ide.eclipse.common.messages"; //$NON-NLS-1$ - - public static String Console_Data_Project_Tag; - - public static String Console_Date_Tag; - - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/StreamHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/StreamHelper.java deleted file mode 100644 index 6ccf4f2..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/StreamHelper.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Eclipse Public License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.eclipse.org/org/documents/epl-v10.php - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.ide.eclipse.common; - -import org.eclipse.ui.console.MessageConsoleStream; - -import java.util.Calendar; - -/** - * Stream helper class. - */ -public class StreamHelper { - - /** - * Prints messages, associated with a project to the specified stream - * @param stream The stream to write to - * @param tag The tag associated to the message. Can be null - * @param objects The objects to print through their toString() method (or directly for - * {@link String} objects. - */ - public static synchronized void printToStream(MessageConsoleStream stream, String tag, - Object... objects) { - String dateTag = getMessageTag(tag); - - for (Object obj : objects) { - stream.print(dateTag); - if (obj instanceof String) { - stream.println((String)obj); - } else { - stream.println(obj.toString()); - } - } - } - - /** - * Creates a string containing the current date/time, and the tag - * @param tag The tag associated to the message. Can be null - * @return The dateTag - */ - public static String getMessageTag(String tag) { - Calendar c = Calendar.getInstance(); - - if (tag == null) { - return String.format(Messages.Console_Date_Tag, c); - } - - return String.format(Messages.Console_Data_Project_Tag, c, tag); - } -} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/messages.properties b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/messages.properties deleted file mode 100644 index dba6edc..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -Console_Date_Tag=[%1$tF %1$tT] -Console_Data_Project_Tag=[%1$tF %1$tT - %2$s] |