KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > adaptor > EclipseAdaptorMsg


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.adaptor;
12
13 import java.util.Date JavaDoc;
14 import org.eclipse.osgi.service.resolver.*;
15 import org.eclipse.osgi.util.NLS;
16
17 public class EclipseAdaptorMsg extends NLS {
18     private static final String JavaDoc BUNDLE_NAME = "org.eclipse.core.runtime.adaptor.EclipseAdaptorMessages"; //$NON-NLS-1$
19

20     public static String JavaDoc ECLIPSE_MISSING_IMPORTED_PACKAGE;
21     public static String JavaDoc ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE;
22     public static String JavaDoc ECLIPSE_MISSING_REQUIRED_BUNDLE;
23     public static String JavaDoc ECLIPSE_MISSING_HOST;
24     public static String JavaDoc ECLIPSE_CANNOT_CHANGE_LOCATION;
25     public static String JavaDoc ECLIPSE_BUNDLESTOPPER_CYCLES_FOUND;
26     public static String JavaDoc ECLIPSE_BUNDLESTOPPER_ERROR_STOPPING_BUNDLE;
27     public static String JavaDoc ECLIPSE_CACHEDMANIFEST_UNEXPECTED_EXCEPTION;
28
29     public static String JavaDoc fileManager_cannotLock;
30     public static String JavaDoc fileManager_couldNotSave;
31     public static String JavaDoc fileManager_updateFailed;
32     public static String JavaDoc fileManager_illegalInReadOnlyMode;
33     public static String JavaDoc fileManager_notOpen;
34
35     public static String JavaDoc ECLIPSE_ADAPTOR_ERROR_XML_SERVICE;
36     public static String JavaDoc ECLIPSE_ADAPTOR_RUNTIME_ERROR;
37     public static String JavaDoc ECLIPSE_ADAPTOR_EXITING;
38
39     public static String JavaDoc ECLIPSE_DATA_MANIFEST_NOT_FOUND;
40     public static String JavaDoc ECLIPSE_CONVERTER_ERROR_CONVERTING;
41     public static String JavaDoc ECLIPSE_DATA_ERROR_READING_MANIFEST;
42     public static String JavaDoc ECLIPSE_CLASSLOADER_CANNOT_GET_HEADERS;
43
44     public static String JavaDoc ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP;
45     public static String JavaDoc ECLIPSE_CLASSLOADER_ACTIVATION;
46     public static String JavaDoc ECLIPSE_CLASSLOADER_ALREADY_STOPPED;
47     public static String JavaDoc ECLIPSE_CLASSLOADER_GENERATED_EXCEPTION;
48     public static String JavaDoc ECLIPSE_CLASSLOADER_CANNOT_SET_CONTEXTFINDER;
49     
50     public static String JavaDoc ECLIPSE_CONSOLE_COMMANDS_HEADER;
51     public static String JavaDoc ECLIPSE_CONSOLE_HELP_DIAG_COMMAND_DESCRIPTION;
52     public static String JavaDoc ECLIPSE_CONSOLE_HELP_ACTIVE_COMMAND_DESCRIPTION;
53     public static String JavaDoc ECLIPSE_CONSOLE_HELP_GETPROP_COMMAND_DESCRIPTION;
54     public static String JavaDoc ECLIPSE_CONSOLE_NO_BUNDLE_SPECIFIED_ERROR;
55     public static String JavaDoc ECLIPSE_CONSOLE_NO_CONSTRAINTS_NO_PLATFORM_ADMIN_MESSAGE;
56     public static String JavaDoc ECLIPSE_CONSOLE_CANNOT_FIND_BUNDLE_ERROR;
57     public static String JavaDoc ECLIPSE_CONSOLE_NO_CONSTRAINTS;
58     public static String JavaDoc ECLIPSE_CONSOLE_OTHER_VERSION;
59     public static String JavaDoc ECLIPSE_CONSOLE_BUNDLES_ACTIVE;
60
61     public static String JavaDoc ECLIPSE_STARTUP_ALREADY_RUNNING;
62     public static String JavaDoc ECLIPSE_STARTUP_STARTUP_ERROR;
63     public static String JavaDoc ECLIPSE_STARTUP_SHUTDOWN_ERROR;
64     public static String JavaDoc ECLIPSE_STARTUP_ERROR_CHECK_LOG;
65     public static String JavaDoc ECLIPSE_STARTUP_NOT_RUNNING;
66     public static String JavaDoc ECLIPSE_STARTUP_ERROR_NO_APPLICATION;
67     public static String JavaDoc ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_ACTIVE;
68     public static String JavaDoc ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED;
69     public static String JavaDoc ECLIPSE_STARTUP_BUNDLE_NOT_FOUND;
70     public static String JavaDoc ECLIPSE_STARTUP_INVALID_PORT;
71     public static String JavaDoc ECLIPSE_STARTUP_FAILED_FIND;
72     public static String JavaDoc ECLIPSE_STARTUP_FAILED_UNINSTALL;
73     public static String JavaDoc ECLIPSE_STARTUP_FAILED_INSTALL;
74     public static String JavaDoc ECLIPSE_STARTUP_FAILED_START;
75     public static String JavaDoc ECLIPSE_STARTUP_APP_ERROR;
76     public static String JavaDoc ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR;
77
78     public static String JavaDoc error_badNL;
79
80     public static String JavaDoc location_cannotLock;
81     public static String JavaDoc location_cannotLockNIO;
82
83     public static String JavaDoc ECLIPSE_CONVERTER_FILENOTFOUND;
84     public static String JavaDoc ECLIPSE_CONVERTER_ERROR_CREATING_BUNDLE_MANIFEST;
85     public static String JavaDoc ECLIPSE_CONVERTER_PLUGIN_LIBRARY_IGNORED;
86
87     public static String JavaDoc ECLIPSE_CONVERTER_ERROR_PARSING_PLUGIN_MANIFEST;
88     public static String JavaDoc ECLIPSE_CONVERTER_MISSING_ATTRIBUTE;
89     public static String JavaDoc parse_error;
90     public static String JavaDoc parse_errorNameLineColumn;
91
92     public static String JavaDoc ECLIPSE_CONVERTER_NO_SAX_FACTORY;
93     public static String JavaDoc ECLIPSE_CONVERTER_PARSE_UNKNOWNTOP_ELEMENT;
94
95     public static final String JavaDoc NEW_LINE = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
96

97     static {
98         // initialize resource bundles
99
NLS.initializeMessages(BUNDLE_NAME, EclipseAdaptorMsg.class);
100     }
101
102     public static String JavaDoc getResolutionFailureMessage(VersionConstraint unsatisfied) {
103         if (unsatisfied.isResolved())
104             throw new IllegalArgumentException JavaDoc();
105         if (unsatisfied instanceof ImportPackageSpecification)
106             return NLS.bind(ECLIPSE_MISSING_IMPORTED_PACKAGE, toString(unsatisfied));
107         else if (unsatisfied instanceof BundleSpecification)
108             if (((BundleSpecification) unsatisfied).isOptional())
109                 return NLS.bind(ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE, toString(unsatisfied));
110             else
111                 return NLS.bind(ECLIPSE_MISSING_REQUIRED_BUNDLE, toString(unsatisfied));
112         else
113             return NLS.bind(ECLIPSE_MISSING_HOST, toString(unsatisfied));
114     }
115
116     /**
117      * Print a debug message to the console.
118      * Pre-pend the message with the current date and the name of the current thread.
119      */

120     public static void debug(String JavaDoc message) {
121         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
122         buffer.append(new Date JavaDoc(System.currentTimeMillis()));
123         buffer.append(" - ["); //$NON-NLS-1$
124
buffer.append(Thread.currentThread().getName());
125         buffer.append("] "); //$NON-NLS-1$
126
buffer.append(message);
127         System.out.println(buffer.toString());
128     }
129
130     private static String JavaDoc toString(VersionConstraint constraint) {
131         org.eclipse.osgi.service.resolver.VersionRange versionRange = constraint.getVersionRange();
132         if (versionRange == null)
133             return constraint.getName();
134         return constraint.getName() + '_' + versionRange;
135     }
136 }
Popular Tags