mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
New implementations to use instead of internal ones.
This commit is contained in:
parent
3cae7720cf
commit
f08de55a15
2 changed files with 60 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
/**
|
||||
* Simple IStatus implementation to avoid using internal classes
|
||||
*/
|
||||
public class CDTStatusInfo implements IStatus {
|
||||
private String text;
|
||||
private int code;
|
||||
|
||||
public CDTStatusInfo() {this(OK, null); }
|
||||
public CDTStatusInfo(int _code, String _text) {
|
||||
text= _text;
|
||||
code= _code;
|
||||
}
|
||||
public IStatus[] getChildren() { return new IStatus[0];}
|
||||
public int getCode() { return code; }
|
||||
public Throwable getException() { return null; }
|
||||
public String getMessage() { return text; }
|
||||
public String getPlugin() { return CUIPlugin.PLUGIN_ID; }
|
||||
public int getSeverity() { return code; }
|
||||
public boolean isMultiStatus() { return false; }
|
||||
public boolean isOK() { return (code == OK); }
|
||||
public boolean matches(int mask) { return (code & mask) != 0; }
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 IBM Corporation 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:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
||||
/**
|
||||
* see org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter
|
||||
*/
|
||||
public class TypedCDTViewerFilter extends ViewerFilter {
|
||||
|
||||
private Class[] types;
|
||||
|
||||
public TypedCDTViewerFilter(Class[] _types) { types= _types; }
|
||||
/**
|
||||
* @see ViewerFilter#select
|
||||
*/
|
||||
public boolean select(Viewer viewer, Object parent, Object element) {
|
||||
for (int i= 0; i < types.length; i++) {
|
||||
if (types[i].isInstance(element)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue