Skip to main content
summaryrefslogtreecommitdiffstats
blob: 6b2bdb60c150a2b4a49ffa1e7d3cb9d35bf13729 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*******************************************************************************
 * Copyright (c) 2011 Red Hat and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David Green <david.green@tasktop.com> - initial contribution
 *     Christian Trutz <christian.trutz@gmail.com> - initial contribution
 *     Chris Aniszczyk <caniszczyk@gmail.com> - initial contribution
 *******************************************************************************/
package org.eclipse.mylyn.github.ui.internal;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;

class GitHubUi {
	public static final String BUNDLE_ID = "org.eclipse.mylyn.github.ui";
	
	public static IStatus createStatus(int severity,String message) {
		return new Status(severity,BUNDLE_ID,message);
	}
	
	public static IStatus createStatus(int severity,String message,Throwable e) {
		return new Status(severity,BUNDLE_ID,message,e);
	}
	
	public static IStatus createErrorStatus(String message) {
		return createStatus(IStatus.ERROR, message);
	}
	
	public static IStatus createErrorStatus(String message,Throwable t) {
		return createStatus(IStatus.ERROR, message,t);
	}

	public static IStatus createErrorStatus(Throwable e) {
		return createStatus(IStatus.ERROR, "Unexpected error: "+e.getMessage(),e);
	}
	
	public static ILog getLog() {
		return Platform.getLog(Platform.getBundle(BUNDLE_ID));
	}
	
	public static void logError(String message,Throwable t) {
		getLog().log(createErrorStatus(message, t));
	}
	
	public static void logError(Throwable t) {
		getLog().log(createErrorStatus(t.getMessage(), t));
	}
}

Back to the top