| 1 | /******************************************************************************* |
|---|---|
| 2 | * Copyright (c) 2000, 2005 IBM Corporation and others. |
| 3 | * |
| 4 | * This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License 2.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * https://www.eclipse.org/legal/epl-2.0/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | * |
| 11 | * Contributors: |
| 12 | * IBM Corporation - initial API and implementation |
| 13 | *******************************************************************************/ |
| 14 | |
| 15 | package org.eclipse.jdt.astview; |
| 16 | |
| 17 | import org.eclipse.core.runtime.IStatus; |
| 18 | import org.eclipse.core.runtime.MultiStatus; |
| 19 | import org.eclipse.core.runtime.Status; |
| 20 | |
| 21 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
| 22 | |
| 23 | public class ASTViewPlugin extends AbstractUIPlugin { |
| 24 | |
| 25 | private static ASTViewPlugin fgDefault; |
| 26 | |
| 27 | public ASTViewPlugin() { |
| 28 | fgDefault= this; |
| 29 | } |
| 30 | |
| 31 | public static String getPluginId() { |
| 32 | return "org.eclipse.jdt.astview"; //$NON-NLS-1$ |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * @return the shared instance |
| 37 | */ |
| 38 | public static ASTViewPlugin getDefault() { |
| 39 | return fgDefault; |
| 40 | } |
| 41 | |
| 42 | public static void log(IStatus status) { |
| 43 | getDefault().getLog().log(status); |
| 44 | } |
| 45 | |
| 46 | public static void logErrorMessage(String message) { |
| 47 | log(new Status(IStatus.ERROR, getPluginId(), IStatus.ERROR, message, null)); |
| 48 | } |
| 49 | |
| 50 | public static void logErrorStatus(String message, IStatus status) { |
| 51 | if (status == null) { |
| 52 | logErrorMessage(message); |
| 53 | return; |
| 54 | } |
| 55 | MultiStatus multi= new MultiStatus(getPluginId(), IStatus.ERROR, message, null); |
| 56 | multi.add(status); |
| 57 | log(multi); |
| 58 | } |
| 59 | |
| 60 | public static void log(String message, Throwable e) { |
| 61 | log(new Status(IStatus.ERROR, getPluginId(), IStatus.ERROR, message, e)); |
| 62 | } |
| 63 | |
| 64 | } |
| 65 |
Members