KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > console > ProcessTypePropertyTester


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.debug.internal.ui.views.console;
12
13 import org.eclipse.core.expressions.PropertyTester;
14 import org.eclipse.debug.core.model.IProcess;
15 import org.eclipse.debug.ui.IDebugUIConstants;
16 import org.eclipse.ui.console.TextConsole;
17
18 /**
19  * Tests if a process type matches the expected value.
20  *
21  * @since 3.1
22  */

23 public class ProcessTypePropertyTester extends PropertyTester {
24
25     /* (non-Javadoc)
26      * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
27      */

28     public boolean test(Object JavaDoc receiver, String JavaDoc property, Object JavaDoc[] args, Object JavaDoc expectedValue) {
29         if (receiver instanceof TextConsole) {
30             TextConsole console = (TextConsole) receiver;
31             IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
32             if (process != null) {
33                 String JavaDoc type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
34                 return (type != null && type.equals(expectedValue));
35             }//end if
36
}//end if
37
return false;
38     }//end test
39

40 }//end class
41
Popular Tags