Browse Source

Moved database connection to DS factory

keep-around/79c49e6f1d553022fee8a81e8364e12f99e7a4a7
Eyck Jentzsch 6 years ago
parent
commit
a0e29e8ae2
6 changed files with 26 additions and 20 deletions
  1. +1
    -0
      com.minres.scviewer.ui/META-INF/MANIFEST.MF
  2. +5
    -0
      com.minres.scviewer.ui/OSGI-INF/component.xml
  3. +3
    -12
      com.minres.scviewer.ui/build.properties
  4. +15
    -5
      com.minres.scviewer.ui/src/com/minres/scviewer/ui/TxEditorPart.java
  5. +2
    -2
      com.minres.scviewer.ui/src/com/minres/scviewer/ui/adapter/TxAdapterFactory.java
  6. +0
    -1
      com.minres.scviewer.ui/src/com/minres/scviewer/ui/handler/RemoveHandler.java

+ 1
- 0
com.minres.scviewer.ui/META-INF/MANIFEST.MF View File

@ -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

+ 5
- 0
com.minres.scviewer.ui/OSGI-INF/component.xml View File

@ -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>

+ 3
- 12
com.minres.scviewer.ui/build.properties View File

@ -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/

+ 15
- 5
com.minres.scviewer.ui/src/com/minres/scviewer/ui/TxEditorPart.java View File

@ -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
}
}

+ 2
- 2
com.minres.scviewer.ui/src/com/minres/scviewer/ui/adapter/TxAdapterFactory.java View File

@ -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};

+ 0
- 1
com.minres.scviewer.ui/src/com/minres/scviewer/ui/handler/RemoveHandler.java View File

@ -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…
Cancel
Save