Skip to content
Snippets Groups Projects
Commit 6bb358f3 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Implemented first part of service-specific details view to test widget swap mechanism.

refs 2460
parent 83463fdb
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,11 @@ import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.part.ViewPart;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUICompositeFactoryBase;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.KISSDetailsUIRegistry;
/**
* {@link ViewPart} for the marker display.
......@@ -99,18 +102,24 @@ public class KISSViewPart extends ViewPart implements ISelectionChangedListener
gui.getDescriptionText().setText(GREETING);
}
/**
* @param service
*/
/** Update the KISS view widgetsa nd controls. */
private void updateWidgets(IIntrospectiveKernelService service) {
gui.getDescriptionText().setText(service.getIntrospectionDescription());
ScrolledComposite sc = gui.getDetailsScrolledComposite();
Control old = sc.getContent();
// TODO: continue HERE
gui.getDetailsScrolledComposite().setContent(null); // FIXME:
if(old != null) {
if(sc.getContent() != null) {
Control old = sc.getContent();
gui.getDetailsScrolledComposite().setContent(null);
old.dispose();
}
IIntrospectionDetailsItem item = service.getDetailsItem();
if(item != null) {
DetailsUICompositeFactoryBase factory =
KISSDetailsUIRegistry.INSTANCE.getCompositeFactory(item.getClass());
if(factory != null) {
Control newContent = factory.createComposite(sc);
sc.setContent(newContent);
}
}
}
}
......@@ -18,7 +18,7 @@ $Id$
package org.fortiss.tooling.kernel.ui.internal.introspection.details;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
......@@ -41,6 +41,6 @@ public abstract class DetailsUICompositeFactoryBase {
this.dataItem = dataItem;
}
/** Creates the {@link Composite} instance within the given parent widget. */
public abstract Composite createComposite(ScrolledComposite parent);
/** Creates the control within the given parent scrolled composite. */
public abstract Control createComposite(ScrolledComposite parent);
}
......@@ -21,6 +21,8 @@ import java.util.HashMap;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.factories.ConstraintCheckerServiceIntrospectionDetailsUIFactory;
/**
* Registry class to provide the details GUI for a given {@link IIntrospectionItem}.
......@@ -39,6 +41,12 @@ public final class KISSDetailsUIRegistry {
private final HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUICompositeFactoryBase> registry =
new HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUICompositeFactoryBase>();
/** Constructor. */
public KISSDetailsUIRegistry() {
register(ConstraintCheckerServiceIntrospectionDetailsItem.class,
new ConstraintCheckerServiceIntrospectionDetailsUIFactory());
}
/** Registers the given composite */
public void register(Class<? extends IIntrospectionDetailsItem> clazz,
DetailsUICompositeFactoryBase detailsCompositeFactory) {
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.kernel.ui.internal.introspection.details.factories;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.service.IConstraintCheckerService;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUICompositeFactoryBase;
/**
* The details view for {@link IIntrospectionItem}s provided by {@link IConstraintCheckerService}.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ConstraintCheckerServiceIntrospectionDetailsUIFactory extends
DetailsUICompositeFactoryBase {
/** The tree with filter widget. */
private FilteredTree filteredTree;
/** {@inheritDoc} */
@Override
public Control createComposite(ScrolledComposite parent) {
filteredTree = new FilteredTree(parent, SWT.BORDER, new PatternFilter(), true) {
/** {@inheritDoc} */
@Override
public void dispose() {
super.dispose();
System.out.println("tree disposed!");
}
};
return filteredTree;
}
}
......@@ -32,6 +32,7 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.service.IConstraintCheckerService;
import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase;
......@@ -165,7 +166,6 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain
/** {@inheritDoc} */
@Override
public IIntrospectionDetailsItem getDetailsItem() {
// TODO Auto-generated method stub
return null;
return new ConstraintCheckerServiceIntrospectionDetailsItem();
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.kernel.introspection.items;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
/**
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ConstraintCheckerServiceIntrospectionDetailsItem implements IIntrospectionDetailsItem {
}
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