Skip to content
Snippets Groups Projects
Commit 7f877835 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

cleaning the code, a better packaging and more reuse

refs 233
parent 74c7cc4d
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ Export-Package: org.fortiss.tooling.base.ui,
org.fortiss.tooling.base.ui.action,
org.fortiss.tooling.base.ui.command,
org.fortiss.tooling.base.ui.compose,
org.fortiss.tooling.base.ui.contentprovider,
org.fortiss.tooling.base.ui.dnd,
org.fortiss.tooling.base.ui.editor,
org.fortiss.tooling.base.ui.editor.gef,
......
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| 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.contentprovider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
/**
* Base implementation of a tree content provider that has an empty default
* implementation for some methods. Some of the methods require implementation
* almost always (e.g. {@link #getElements(Object)} and
* {@link #getParent(Object)}), but for simple content providers the base
* implementation is sufficient.
*
* This class is taken from ConQAT.
*
* @author hummelb
* @author $Author: deissenb $
* @version $Rev: 34252 $
* @ConQAT.Rating RED Hash:
*/
public abstract class TreeContentProviderBase implements ITreeContentProvider {
/**
* {@inheritDoc}
* <p>
* Default implementation returns null, which makes automatic expansion of
* externally set selection impossible.
*/
@Override
public Object getParent(Object inputElement) {
return null;
}
/**
* {@inheritDoc}
* <p>
* Uses the result of {@link #getChildren(Object)} to determine result.
*/
@Override
public boolean hasChildren(Object inputElement) {
Object[] children = getChildren(inputElement);
return children != null && children.length > 0;
}
/**
* {@inheritDoc}
* <p>
* Just calls {@link #getChildren(Object)}.
*/
@Override
public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
/**
* {@inheritDoc}
* <p>
* Empty implementation.
*/
@Override
public void dispose() {
// not needed
}
/**
* {@inheritDoc}
* <p>
* Empty implementation.
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// not needed
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment