Moved database connection to DS factory
This commit is contained in:
parent
ef3ce7273a
commit
a0e29e8ae2
|
@ -21,3 +21,4 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.google.common.collect
|
||||
Service-Component: OSGI-INF/component.xml
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.ui">
|
||||
<implementation class="com.minres.scviewer.ui.TxEditorPart"/>
|
||||
<reference bind="bind" cardinality="1..1" interface="com.minres.scviewer.database.IWaveformDbFactory" name="IWaveformDbFactory" policy="static" unbind="unbin"/>
|
||||
</scr:component>
|
|
@ -1,17 +1,8 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2014, 2015 MINRES Technologies GmbH 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:
|
||||
# MINRES Technologies GmbH - initial API and implementation
|
||||
###############################################################################
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
.,\
|
||||
contexts.xml,\
|
||||
res/
|
||||
source.. = src/
|
||||
res/,\
|
||||
OSGI-INF/
|
||||
jars.compile.order = .
|
||||
source.. = src/
|
||||
|
|
|
@ -46,14 +46,25 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
|
|||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
import com.minres.scviewer.database.IWaveformEvent;
|
||||
import com.minres.scviewer.database.WaveformDb;
|
||||
import com.minres.scviewer.database.swt.GotoDirection;
|
||||
import com.minres.scviewer.database.swt.TxDisplay;
|
||||
import com.minres.scviewer.ui.views.TxOutlinePage;
|
||||
|
||||
public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPageContributor {
|
||||
|
||||
private IWaveformDbFactory waveformDbFactory;
|
||||
|
||||
public synchronized void bind(IWaveformDbFactory factory){
|
||||
waveformDbFactory=factory;
|
||||
}
|
||||
|
||||
public synchronized void unbind(IWaveformDbFactory factory){
|
||||
if(waveformDbFactory==factory)
|
||||
waveformDbFactory=null;
|
||||
}
|
||||
|
||||
private final static String[] zoomLevel={
|
||||
"1fs", "10fs", "100fs",
|
||||
"1ps", "10ps", "100ps",
|
||||
|
@ -85,7 +96,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
|||
@Override
|
||||
public void createPartControl(Composite parent) {
|
||||
myParent=parent;
|
||||
database=new WaveformDb();
|
||||
database=waveformDbFactory.getDatabase();
|
||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
@ -273,7 +284,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
|||
public void doSaveAs() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public Object getAdapter(Class type) {
|
||||
if (type == IContentOutlinePage.class) // outline page
|
||||
|
@ -382,8 +393,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
|||
}
|
||||
|
||||
public void removeSelected() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
// TODO TxDisplay needs to be extended
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.minres.scviewer.database.ITx;
|
|||
|
||||
public class TxAdapterFactory implements IAdapterFactory {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||
if (adapterType == IPropertySource.class)
|
||||
|
@ -25,7 +25,7 @@ public class TxAdapterFactory implements IAdapterFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public Class[] getAdapterList() {
|
||||
return new Class[]{IPropertySource.class};
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.internal.misc.StringMatcher;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformEvent;
|
||||
|
|
Loading…
Reference in New Issue