diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/StatusUtils.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/StatusUtils.java index 888967a45799aff58525866d64b7903661f23876..c5a3a0b6dd95e511a8a84a116fb619ffe8430b01 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/StatusUtils.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/StatusUtils.java @@ -1,72 +1,64 @@ -/*--------------------------------------------------------------------------+ -$Id: StatusUtils.java 5274 2012-08-02 07:54:11Z gareis $ -| | -| Copyright 2011 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 | -| | -| 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 org.fortiss.tooling.base.ui.utils; - -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * Methods for accessing the status line - * - * @author gareis - * @author $Author: gareis $ - * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: - */ -public class StatusUtils { - - /** Returns a Status Line object of the current window */ - public static IStatusLineManager getStatusLine() { - - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - - IWorkbenchPage page = window.getActivePage(); - - IWorkbenchPart part = page.getActivePart(); - IWorkbenchPartSite site = part.getSite(); - - IViewSite vSite = (IViewSite)site; - - IActionBars actionBars = vSite.getActionBars(); - - if(actionBars == null) - return null; - - IStatusLineManager statusLine = actionBars.getStatusLineManager(); - - if(statusLine == null) { - return null; - } - return statusLine; - - } - - /** writes messages into the status line of the current window */ - - public static void setStatusMessage(String message) { - if(getStatusLine() != null) - getStatusLine().setMessage(message); - - } -} +/*--------------------------------------------------------------------------+ +$Id: StatusUtils.java 5274 2012-08-02 07:54:11Z gareis $ +| | +| Copyright 2011 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 | +| | +| 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 org.fortiss.tooling.base.ui.utils; + +import static org.conqat.ide.commons.ui.ui.WorkbenchUtils.getActiveWorkbenchPage; + +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; + +/** + * Methods for accessing the status line + * + * @author gareis + * @author $Author: gareis $ + * @version $Rev: 18709 $ + * @ConQAT.Rating YELLOW Hash: 8E2E1AD408AAAE041B6043220648FE3D + */ +public class StatusUtils { + + /** Returns a Status Line object of the current window */ + public static IStatusLineManager getStatusLine() { + IWorkbenchPage page = getActiveWorkbenchPage(); + IWorkbenchPart part = page.getActivePart(); + IWorkbenchPartSite site = part.getSite(); + IViewSite vSite = (IViewSite)site; + IActionBars actionBars = vSite.getActionBars(); + + if(actionBars == null) { + return null; + } + + IStatusLineManager statusLine = actionBars.getStatusLineManager(); + if(statusLine == null) { + return null; + } + return statusLine; + } + + /** Writes messages into the status line of the current window */ + public static void setStatusMessage(String message) { + if(getStatusLine() != null) { + getStatusLine().setMessage(message); + } + } +}