diff options
author | Eike Stepper | 2012-11-06 13:08:40 +0000 |
---|---|---|
committer | Eike Stepper | 2012-11-06 13:08:40 +0000 |
commit | 0aa08334f3433908823bcb398807ff390af2bbf5 (patch) | |
tree | afcd7f42b2a69b21302c2e47e71893bec13c0ced /plugins | |
parent | 9600fac225df0217ffd815626678e8f063256c32 (diff) | |
download | cdo-0aa08334f3433908823bcb398807ff390af2bbf5.tar.gz cdo-0aa08334f3433908823bcb398807ff390af2bbf5.tar.xz cdo-0aa08334f3433908823bcb398807ff390af2bbf5.zip |
Offline Example
Diffstat (limited to 'plugins')
50 files changed, 4805 insertions, 544 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/.externalToolBuilders/org.eclipse.emf.cdo.examples.client.offline.launch b/plugins/org.eclipse.emf.cdo.examples.client.offline/.externalToolBuilders/org.eclipse.emf.cdo.examples.client.offline.launch index 3af3dcccbc..144e35bb1a 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/.externalToolBuilders/org.eclipse.emf.cdo.examples.client.offline.launch +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/.externalToolBuilders/org.eclipse.emf.cdo.examples.client.offline.launch @@ -4,18 +4,16 @@ <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> <booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/org.eclipse.emf.cdo.examples.client.offline" type="4"/> <item path="/org.eclipse.emf.cdo.examples.installer/examples" type="2"/> </resources>}"/> -<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/> -<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/> <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.examples.client.offline"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master" type="2"/> <item path="/org.eclipse.emf.cdo.examples.master/.classpath" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/.externalToolBuilders" type="2"/> <item path="/org.eclipse.emf.cdo.examples.master/.gitignore" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/.project" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/.settings" type="2"/> <item path="/org.eclipse.emf.cdo.examples.master/about.html" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/build.properties" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/config" type="2"/> <item path="/org.eclipse.emf.cdo.examples.master/copyright.txt" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/ExampleMasterServer.launch" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/META-INF" type="2"/> <item path="/org.eclipse.emf.cdo.examples.master/plugin.properties" type="1"/> <item path="/org.eclipse.emf.cdo.examples.master/README.html" type="1"/> </resources>}"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:/org.eclipse.emf.cdo.examples.master}/.externalToolBuilders/copyExample.ant"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value=""/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/org.eclipse.emf.cdo.examples.client.offline" type="4"/> <item path="/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline" type="2"/> </resources>}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:/org.eclipse.emf.cdo.examples.client.offline}/.externalToolBuilders/copyExample.ant"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dbuild.project=${project_loc:/org.eclipse.emf.cdo.examples.client.offline}"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> <stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/.project b/plugins/org.eclipse.emf.cdo.examples.client.offline/.project index cd3302d1d2..47cabb0053 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/.project +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/.project @@ -26,12 +26,16 @@ </buildCommand> <buildCommand> <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> - <triggers>full,incremental,</triggers> + <triggers>auto,full,incremental,</triggers> <arguments> <dictionary> <key>LaunchConfigHandle</key> <value><project>/.externalToolBuilders/org.eclipse.emf.cdo.examples.client.offline.launch</value> </dictionary> + <dictionary> + <key>incclean</key> + <value>true</value> + </dictionary> </arguments> </buildCommand> </buildSpec> diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF index 0fcf9585ed..946a6439ae 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF @@ -16,8 +16,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)", org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)", org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)", - org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)", - org.eclipse.nebula.widgets.oscilloscope;bundle-version="[1.0.0,2.0.0)" + org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)" Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)" Bundle-ClassPath: . Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.0";x-internal:=true, diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java index 5d9e3e9809..f04b27ecf8 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java @@ -29,8 +29,6 @@ import java.io.File; */ public class Application implements IApplication { - public static final String TITLE = "CDO Offline Example"; - public static final String PLUGIN_ID = "org.eclipse.emf.cdo.examples.client.offline"; private static final String ROOT_PROPERTY = "node.manager.root"; diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java index dbd3c7a274..d458ca8037 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.examples.client.offline; +import org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView.OScope.Channel; import org.eclipse.emf.cdo.server.net4j.FailoverMonitor; import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol; @@ -20,16 +21,22 @@ import org.eclipse.net4j.util.event.IEvent; import org.eclipse.net4j.util.event.IListener; import org.eclipse.net4j.util.ui.views.ItemProvider; -import org.eclipse.nebula.widgets.oscilloscope.multichannel.Oscilloscope; -import org.eclipse.nebula.widgets.oscilloscope.multichannel.OscilloscopeDispatcher; -import org.eclipse.nebula.widgets.oscilloscope.multichannel.OscilloscopeStackAdapter; import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; -import java.util.HashMap; -import java.util.Map; +import java.io.ByteArrayInputStream; import java.util.Random; +import java.util.SortedMap; +import java.util.TreeMap; /** * @author Eike Stepper @@ -38,14 +45,6 @@ public class FailoverMonitorView extends AbstractView<FailoverMonitor> { public static final String ID = "org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView"; //$NON-NLS-1$ - private static final int AMPLITUDE = 100; - - private static final int LENGTH = 5; - - private static final int[] ZERO = new int[LENGTH]; - - private static final int[] PEAK = createPeakValues(); - public FailoverMonitorView() { super(FailoverMonitor.class); @@ -54,116 +53,367 @@ public class FailoverMonitorView extends AbstractView<FailoverMonitor> @Override protected void createPane(Composite parent, FailoverMonitor monitor, ItemProvider<FailoverMonitor> itemProvider) { - final Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new FillLayout(SWT.VERTICAL)); - + final OScope scope = new OScope(parent, SWT.NONE); monitor.addListener(new ContainerEventAdapter<AgentProtocol>() { - private Map<String, AgentOscilloscope> oscilloscopes = new HashMap<String, AgentOscilloscope>(); - @Override protected void onAdded(IContainer<AgentProtocol> monitor, final AgentProtocol agent) { - final AgentOscilloscope oscilloscope = getOscilloscope(composite, agent); + final Channel channel = scope.getChannel(agent.getConnectorDescription()); agent.addListener(new IListener() { public void notifyEvent(IEvent event) { if (event instanceof SignalScheduledEvent) { - oscilloscope.scheduleValues(PEAK); + if (!scope.isDisposed()) + { + scope.getDisplay().asyncExec(new Runnable() + { + public void run() + { + if (!scope.isDisposed()) + { + channel.peak(); + } + } + }); + } } } }); } + }); + } - @Override - protected void onRemoved(IContainer<AgentProtocol> container, AgentProtocol agent) - { - AgentOscilloscope oscilloscope = getOscilloscope(composite, agent); - oscilloscope.scheduleValues(ZERO); - } + @Override + public void setFocus() + { + } - protected AgentOscilloscope getOscilloscope(final Composite parent, AgentProtocol agent) - { - String key = agent.toString(); + /** + * @author Eike Stepper + */ + public static class OScope extends Canvas implements Runnable, PaintListener, ControlListener + { + public static final int[] PEAK = { 25, 50, 100, 80, 100, 50, 25, 10, 5 }; + + private static final String INITIAL = "#INITIAL#"; + + private static final Random RANDOM = new Random(); + + private static final int[] BACKGROUND = { 255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 72, 0, 72, 0, + 0, 255, 254, 0, 19, 67, 114, 101, 97, 116, 101, 100, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80, 255, 219, 0, + 67, 0, 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12, 8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, + 15, 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26, 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, + 36, 28, 30, 31, 30, 255, 219, 0, 67, 1, 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 255, 192, 0, 17, 8, 0, 20, 0, 20, 3, 1, 34, 0, + 2, 17, 1, 3, 17, 1, 255, 196, 0, 23, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 7, 255, 196, + 0, 34, 16, 0, 2, 2, 0, 5, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 2, 20, 33, 52, 84, 17, 115, 145, 178, + 209, 97, 255, 196, 0, 23, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 3, 255, 196, 0, 27, 17, + 0, 2, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 17, 33, 49, 81, 18, 255, 218, 0, 12, 3, 1, 0, 2, 17, + 3, 17, 0, 63, 0, 225, 37, 87, 118, 245, 59, 79, 217, 140, 212, 60, 24, 60, 226, 250, 83, 110, 196, 74, 10, 205, + 211, 133, 245, 141, 180, 155, 122, 106, 255, 0, 78, 77, 187, 88, 4, 164, 237, 96, 204, 5, 89, 168, 120, 48, + 121, 197, 244, 10, 223, 5, 233, 240, 148, 170, 238, 222, 167, 105, 251, 48, 9, 237, 20, 182, 137, 64, 6, 140, + 255, 217 }; + + private SortedMap<String, Channel> channels = new TreeMap<String, Channel>(); + + private Channel[] channelArray; + + private int width; + + private int height; + + private int channelHeight; + + private int x; + + private boolean resizing; + + private Color black; + + private Color white; + + public OScope(Composite parent, int style) + { + super(parent, style | SWT.DOUBLE_BUFFERED); + black = getDisplay().getSystemColor(SWT.COLOR_BLACK); + white = getDisplay().getSystemColor(SWT.COLOR_WHITE); + + setBackgroundImage(createBackgroundImage()); + addPaintListener(this); + addControlListener(this); + + Channel channel = new Channel(INITIAL); + channels.put(INITIAL, channel); + channelArray = new Channel[] { channel }; + + run(); + } - final AgentOscilloscope[] oscilloscope = { oscilloscopes.get(key) }; - if (oscilloscope[0] == null) + public int getTimerExecMillis() + { + return 25; + } + + @Override + public void dispose() + { + super.dispose(); + } + + public Channel getChannel(String name) + { + synchronized (channels) + { + Channel channel = channels.get(name); + if (channel == null) { - if (!parent.isDisposed()) + boolean resize = false; + + channel = channels.remove(INITIAL); + if (channel == null) + { + channel = new Channel(name); + resize = true; + } + else + { + channel.setName(name); + } + + channels.put(name, channel); + channelArray = channels.values().toArray(new Channel[channels.size()]); + + if (resize) { - parent.getDisplay().syncExec(new Runnable() + getDisplay().syncExec(new Runnable() { public void run() { - oscilloscope[0] = new AgentOscilloscope(parent); - parent.layout(); + controlResized(null); } }); - - oscilloscopes.put(key, oscilloscope[0]); } } - return oscilloscope[0]; + return channel; } - }); - } + } - @Override - public void setFocus() - { - } + public void controlMoved(ControlEvent e) + { + // Do nothing + } - private static int[] createPeakValues() - { - Random random = new Random(3); + public void controlResized(ControlEvent e) + { + try + { + resizing = true; + Point size = getSize(); + width = size.x; + height = size.y; + + int count = channelArray.length; + if (count == 0) + { + return; + } + + x = Math.min(x, width); + + int oldChannelHeight = channelHeight; + if (oldChannelHeight == 0) + { + oldChannelHeight = 1; + } + + channelHeight = height / (2 * count); + + int y = channelHeight; + for (Channel channel : channelArray) + { + channel.resize(y, oldChannelHeight); + y += channelHeight + channelHeight; + } + } + finally + { + resizing = false; + } + } - int length = 2 * LENGTH; - int[] values = new int[length]; - for (int i = 0; i < length; i++) + public void paintControl(PaintEvent e) { - values[i] = random.nextInt(2 * AMPLITUDE) - AMPLITUDE; - values[++i] = -values[i - 1]; + if (!resizing) + { + GC gc = e.gc; + gc.setAdvanced(true); + gc.setAntialias(SWT.ON); + + for (Channel channel : channelArray) + { + channel.paint(e.gc); + } + } } - return values; - } + public void run() + { + if (isDisposed()) + { + return; + } - /** - * @author Eike Stepper - */ - private static class AgentOscilloscope extends Oscilloscope - { - private int[] values = ZERO; + redraw(); + + if (++x >= width) + { + x = 0; + } + + getDisplay().timerExec(getTimerExecMillis(), this); + } + + protected Image createBackgroundImage() + { + byte[] bytes = new byte[BACKGROUND.length]; + for (int i = 0; i < BACKGROUND.length; i++) + { + bytes[i] = (byte)BACKGROUND[i]; + } - public AgentOscilloscope(Composite parent) + return new Image(getDisplay(), new ByteArrayInputStream(bytes)); + } + + /** + * @author Eike Stepper + */ + public class Channel { - super(parent, SWT.NONE); - setConnect(0, true); - setSteady(0, true, -1); - setFade(0, false); - setTailSize(0, Oscilloscope.TAILSIZE_MAX); - setTailFade(0, 0); + private String name; + + private int[] values; + + private int[] head; + + private int headIndex; + + private boolean headNegate; + + private int y; + + public Channel(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setHead(int[] head) + { + headIndex = 0; + headNegate = false; + this.head = head; + } + + public void peak() + { + setHead(PEAK); + } + + @Override + public String toString() + { + return "Channel[" + name + "]"; + } - addStackListener(0, new OscilloscopeStackAdapter() + public void resize(int y, int oldChannelHeight) { - @Override - public void stackEmpty(Oscilloscope scope, int channel) + int max = 0; + int[] newValues = new int[2 * width]; + if (values != null) { - setValues(0, values); - values = ZERO; + System.arraycopy(values, 0, newValues, 0, Math.min(values.length, newValues.length)); + max = Math.min(values.length / 2, width); } - }); - OscilloscopeDispatcher dispatcher = new OscilloscopeDispatcher(0, this); - dispatcher.dispatch(); - } + int x = 0; + for (; x < max; x++) + { + int i = 2 * x; + newValues[i] = x; + newValues[i + 1] = (newValues[i + 1] - this.y) * channelHeight / oldChannelHeight + y; + } - public void scheduleValues(int[] values) - { - this.values = values; + for (; x < width; x++) + { + int i = 2 * x; + newValues[i] = x; + newValues[i + 1] = y; + } + + values = newValues; + this.y = y; + } + + public void paint(GC gc) + { + int i = 2 * x + 1; + if (values == null || i >= values.length) + { + return; + } + + int value = getNextValue() + RANDOM.nextInt(4) - 2; + int fx = y + value * channelHeight / 100; + values[i] = fx; + + gc.setForeground(white); + gc.setLineWidth(1); + gc.drawPolyline(values); + + gc.setForeground(black); + gc.setLineWidth(2); + gc.drawRectangle(x, fx, 2, 2); + } + + void setName(String name) + { + this.name = name; + } + + private int getNextValue() + { + if (head == null) + { + return 0; + } + + int value; + if (headNegate) + { + value = -head[headIndex]; + if (++headIndex >= head.length) + { + setHead(null); + headNegate = !headNegate; + } + } + else + { + value = head[headIndex]; + } + + headNegate = !headNegate; + return value; + } } } } diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java index 35c0d6b07e..653047b32d 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.examples.client.offline; - /** * @author Eike Stepper */ diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java index 2168cea1af..cb025c7102 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java @@ -59,6 +59,8 @@ public class NodeManagerDialog extends TitleAreaDialog private boolean updatingDetails; + public static final String TITLE = "CDO Offline Example"; + public NodeManagerDialog(Shell parentShell, NodeManager nodeManager) { super(parentShell); @@ -86,7 +88,7 @@ public class NodeManagerDialog extends TitleAreaDialog protected void configureShell(Shell newShell) { super.configureShell(newShell); - newShell.setText(Application.TITLE); + newShell.setText(TITLE); } @Override diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java index 81c45d08bd..5c04b5acc3 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java @@ -148,7 +148,7 @@ public abstract class NodeType extends SetContainer<Node> implements IElement public void configureWindow(IWorkbenchWindowConfigurer configurer) { configurer.setInitialSize(new Point(1000, 700)); - configurer.setTitle(Application.TITLE); + configurer.setTitle(Application.NODE.getName()); configurer.setShowCoolBar(false); configurer.setShowMenuBar(false); configurer.setShowStatusLine(false); @@ -285,7 +285,7 @@ public abstract class NodeType extends SetContainer<Node> implements IElement protected IRepository createRepository(Node node) { JdbcDataSource dataSource = new JdbcDataSource(); - dataSource.setURL("jdbc:h2:" + node.getFolder() + "/repository"); + dataSource.setURL("jdbc:h2:" + node.getFolder() + "/db/repository"); IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true); IDBAdapter dbAdapter = new H2Adapter(); diff --git a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java index d8a285807a..3bcc1029a6 100644 --- a/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java +++ b/plugins/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java @@ -10,12 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.swt; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; @@ -28,6 +22,12 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + /** * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. * <p> @@ -40,408 +40,499 @@ import org.eclipse.swt.widgets.Display; * @author scheglov_ke * @author Dan Rubel */ -public class SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Color - // - //////////////////////////////////////////////////////////////////////////// - private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); - /** - * Returns the system {@link Color} matching the specific ID. - * - * @param systemColorID - * the ID value for the color - * @return the system {@link Color} matching the specific ID - */ - public static Color getColor(int systemColorID) { - Display display = Display.getCurrent(); - return display.getSystemColor(systemColorID); - } - /** - * Returns a {@link Color} given its red, green and blue component values. - * - * @param r - * the red component of the color - * @param g - * the green component of the color - * @param b - * the blue component of the color - * @return the {@link Color} matching the given red, green and blue component values - */ - public static Color getColor(int r, int g, int b) { - return getColor(new RGB(r, g, b)); - } - /** - * Returns a {@link Color} given its RGB value. - * - * @param rgb - * the {@link RGB} value of the color - * @return the {@link Color} matching the RGB value - */ - public static Color getColor(RGB rgb) { - Color color = m_colorMap.get(rgb); - if (color == null) { - Display display = Display.getCurrent(); - color = new Color(display, rgb); - m_colorMap.put(rgb, color); - } - return color; - } - /** - * Dispose of all the cached {@link Color}'s. - */ - public static void disposeColors() { - for (Color color : m_colorMap.values()) { - color.dispose(); - } - m_colorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps image paths to images. - */ - private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); - /** - * Returns an {@link Image} encoded by the specified {@link InputStream}. - * - * @param stream - * the {@link InputStream} encoding the image data - * @return the {@link Image} encoded by the specified input stream - */ - protected static Image getImage(InputStream stream) throws IOException { - try { - Display display = Display.getCurrent(); - ImageData data = new ImageData(stream); - if (data.transparentPixel > 0) { - return new Image(display, data, data.getTransparencyMask()); - } - return new Image(display, data); - } finally { - stream.close(); - } - } - /** - * Returns an {@link Image} stored in the file at the specified path. - * - * @param path - * the path to the image file - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(String path) { - Image image = m_imageMap.get(path); - if (image == null) { - try { - image = getImage(new FileInputStream(path)); - m_imageMap.put(path, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(path, image); - } - } - return image; - } - /** - * Returns an {@link Image} stored in the file at the specified path relative to the specified class. - * - * @param clazz - * the {@link Class} relative to which to find the image - * @param path - * the path to the image file, if starts with <code>'/'</code> - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(Class<?> clazz, String path) { - String key = clazz.getName() + '|' + path; - Image image = m_imageMap.get(key); - if (image == null) { - try { - image = getImage(clazz.getResourceAsStream(path)); - m_imageMap.put(key, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(key, image); - } - } - return image; - } - private static final int MISSING_IMAGE_SIZE = 10; - /** - * @return the small {@link Image} that can be used as placeholder for missing image. - */ - private static Image getMissingImage() { - Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - // - GC gc = new GC(image); - gc.setBackground(getColor(SWT.COLOR_RED)); - gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - gc.dispose(); - // - return image; - } - /** - * Style constant for placing decorator image in top left corner of base image. - */ - public static final int TOP_LEFT = 1; - /** - * Style constant for placing decorator image in top right corner of base image. - */ - public static final int TOP_RIGHT = 2; - /** - * Style constant for placing decorator image in bottom left corner of base image. - */ - public static final int BOTTOM_LEFT = 3; - /** - * Style constant for placing decorator image in bottom right corner of base image. - */ - public static final int BOTTOM_RIGHT = 4; - /** - * Internal value. - */ - protected static final int LAST_CORNER_KEY = 5; - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @return {@link Image} The resulting decorated image - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @param corner - * the corner to place decorator image - * @return the resulting decorated {@link Image} - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap<Image, Image>(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - Rectangle bib = baseImage.getBounds(); - Rectangle dib = decorator.getBounds(); - // - result = new Image(Display.getCurrent(), bib.width, bib.height); - // - GC gc = new GC(result); - gc.drawImage(baseImage, 0, 0); - if (corner == TOP_LEFT) { - gc.drawImage(decorator, 0, 0); - } else if (corner == TOP_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - gc.drawImage(decorator, 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); - } - gc.dispose(); - // - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached {@link Image}'s. - */ - public static void disposeImages() { - // dispose loaded images - { - for (Image image : m_imageMap.values()) { - image.dispose(); - } - m_imageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Font - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps font names to fonts. - */ - private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); - /** - * Maps fonts to their bold versions. - */ - private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); - /** - * Returns a {@link Font} based on its name, height and style. - * - * @param name - * the name of the font - * @param height - * the height of the font - * @param style - * the style of the font - * @return {@link Font} The font matching the name, height and style - */ - public static Font getFont(String name, int height, int style) { - return getFont(name, height, style, false, false); - } - /** - * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline - * flags are also supported. - * - * @param name - * the name of the font - * @param size - * the size of the font - * @param style - * the style of the font - * @param strikeout - * the strikeout flag (warning: Windows only) - * @param underline - * the underline flag (warning: Windows only) - * @return {@link Font} The font matching the name, height, style, strikeout and underline - */ - public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { - String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; - Font font = m_fontMap.get(fontName); - if (font == null) { - FontData fontData = new FontData(name, size, style); - if (strikeout || underline) { - try { - Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ - Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ - if (logFont != null && logFontClass != null) { - if (strikeout) { - logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - if (underline) { - logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - } - } catch (Throwable e) { - System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - font = new Font(Display.getCurrent(), fontData); - m_fontMap.put(fontName, font); - } - return font; - } - /** - * Returns a bold version of the given {@link Font}. - * - * @param baseFont - * the {@link Font} for which a bold version is desired - * @return the bold version of the given {@link Font} - */ - public static Font getBoldFont(Font baseFont) { - Font font = m_fontToBoldFontMap.get(baseFont); - if (font == null) { - FontData fontDatas[] = baseFont.getFontData(); - FontData data = fontDatas[0]; - font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); - m_fontToBoldFontMap.put(baseFont, font); - } - return font; - } - /** - * Dispose all of the cached {@link Font}'s. - */ - public static void disposeFonts() { - // clear fonts - for (Font font : m_fontMap.values()) { - font.dispose(); - } - m_fontMap.clear(); - // clear bold fonts - for (Font font : m_fontToBoldFontMap.values()) { - font.dispose(); - } - m_fontToBoldFontMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Cursor - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps IDs to cursors. - */ - private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); - /** - * Returns the system cursor matching the specific ID. - * - * @param id - * int The ID value for the cursor - * @return Cursor The system cursor matching the specific ID - */ - public static Cursor getCursor(int id) { - Integer key = Integer.valueOf(id); - Cursor cursor = m_idToCursorMap.get(key); - if (cursor == null) { - cursor = new Cursor(Display.getDefault(), id); - m_idToCursorMap.put(key, cursor); - } - return cursor; - } - /** - * Dispose all of the cached cursors. - */ - public static void disposeCursors() { - for (Cursor cursor : m_idToCursorMap.values()) { - cursor.dispose(); - } - m_idToCursorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeImages(); - disposeFonts(); - disposeCursors(); - } -}
\ No newline at end of file +public class SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Color + // + // ////////////////////////////////////////////////////////////////////////// + private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); + + /** + * Returns the system {@link Color} matching the specific ID. + * + * @param systemColorID + * the ID value for the color + * @return the system {@link Color} matching the specific ID + */ + public static Color getColor(int systemColorID) + { + Display display = Display.getCurrent(); + return display.getSystemColor(systemColorID); + } + + /** + * Returns a {@link Color} given its red, green and blue component values. + * + * @param r + * the red component of the color + * @param g + * the green component of the color + * @param b + * the blue component of the color + * @return the {@link Color} matching the given red, green and blue component values + */ + public static Color getColor(int r, int g, int b) + { + return getColor(new RGB(r, g, b)); + } + + /** + * Returns a {@link Color} given its RGB value. + * + * @param rgb + * the {@link RGB} value of the color + * @return the {@link Color} matching the RGB value + */ + public static Color getColor(RGB rgb) + { + Color color = m_colorMap.get(rgb); + if (color == null) + { + Display display = Display.getCurrent(); + color = new Color(display, rgb); + m_colorMap.put(rgb, color); + } + return color; + } + + /** + * Dispose of all the cached {@link Color}'s. + */ + public static void disposeColors() + { + for (Color color : m_colorMap.values()) + { + color.dispose(); + } + m_colorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps image paths to images. + */ + private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); + + /** + * Returns an {@link Image} encoded by the specified {@link InputStream}. + * + * @param stream + * the {@link InputStream} encoding the image data + * @return the {@link Image} encoded by the specified input stream + */ + protected static Image getImage(InputStream stream) throws IOException + { + try + { + Display display = Display.getCurrent(); + ImageData data = new ImageData(stream); + if (data.transparentPixel > 0) + { + return new Image(display, data, data.getTransparencyMask()); + } + return new Image(display, data); + } + finally + { + stream.close(); + } + } + + /** + * Returns an {@link Image} stored in the file at the specified path. + * + * @param path + * the path to the image file + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(String path) + { + Image image = m_imageMap.get(path); + if (image == null) + { + try + { + image = getImage(new FileInputStream(path)); + m_imageMap.put(path, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(path, image); + } + } + return image; + } + + /** + * Returns an {@link Image} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image + * @param path + * the path to the image file, if starts with <code>'/'</code> + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(Class<?> clazz, String path) + { + String key = clazz.getName() + '|' + path; + Image image = m_imageMap.get(key); + if (image == null) + { + try + { + image = getImage(clazz.getResourceAsStream(path)); + m_imageMap.put(key, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(key, image); + } + } + return image; + } + + private static final int MISSING_IMAGE_SIZE = 10; + + /** + * @return the small {@link Image} that can be used as placeholder for missing image. + */ + private static Image getMissingImage() + { + Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + // + GC gc = new GC(image); + gc.setBackground(getColor(SWT.COLOR_RED)); + gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + gc.dispose(); + // + return image; + } + + /** + * Style constant for placing decorator image in top left corner of base image. + */ + public static final int TOP_LEFT = 1; + + /** + * Style constant for placing decorator image in top right corner of base image. + */ + public static final int TOP_RIGHT = 2; + + /** + * Style constant for placing decorator image in bottom left corner of base image. + */ + public static final int BOTTOM_LEFT = 3; + + /** + * Style constant for placing decorator image in bottom right corner of base image. + */ + public static final int BOTTOM_RIGHT = 4; + + /** + * Internal value. + */ + protected static final int LAST_CORNER_KEY = 5; + + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @return {@link Image} The resulting decorated image + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @param corner + * the corner to place decorator image + * @return the resulting decorated {@link Image} + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap<Image, Image>(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) + { + Rectangle bib = baseImage.getBounds(); + Rectangle dib = decorator.getBounds(); + // + result = new Image(Display.getCurrent(), bib.width, bib.height); + // + GC gc = new GC(result); + gc.drawImage(baseImage, 0, 0); + if (corner == TOP_LEFT) + { + gc.drawImage(decorator, 0, 0); + } + else if (corner == TOP_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + gc.drawImage(decorator, 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); + } + gc.dispose(); + // + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached {@link Image}'s. + */ + public static void disposeImages() + { + // dispose loaded images + { + for (Image image : m_imageMap.values()) + { + image.dispose(); + } + m_imageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) + { + for (Image image : decoratedMap.values()) + { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Font + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps font names to fonts. + */ + private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); + + /** + * Maps fonts to their bold versions. + */ + private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); + + /** + * Returns a {@link Font} based on its name, height and style. + * + * @param name + * the name of the font + * @param height + * the height of the font + * @param style + * the style of the font + * @return {@link Font} The font matching the name, height and style + */ + public static Font getFont(String name, int height, int style) + { + return getFont(name, height, style, false, false); + } + + /** + * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline + * flags are also supported. + * + * @param name + * the name of the font + * @param size + * the size of the font + * @param style + * the style of the font + * @param strikeout + * the strikeout flag (warning: Windows only) + * @param underline + * the underline flag (warning: Windows only) + * @return {@link Font} The font matching the name, height, style, strikeout and underline + */ + public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) + { + String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; + Font font = m_fontMap.get(fontName); + if (font == null) + { + FontData fontData = new FontData(name, size, style); + if (strikeout || underline) + { + try + { + Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ + Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ + if (logFont != null && logFontClass != null) + { + if (strikeout) + { + logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + if (underline) + { + logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + } + } + catch (Throwable e) + { + System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + font = new Font(Display.getCurrent(), fontData); + m_fontMap.put(fontName, font); + } + return font; + } + + /** + * Returns a bold version of the given {@link Font}. + * + * @param baseFont + * the {@link Font} for which a bold version is desired + * @return the bold version of the given {@link Font} + */ + public static Font getBoldFont(Font baseFont) + { + Font font = m_fontToBoldFontMap.get(baseFont); + if (font == null) + { + FontData fontDatas[] = baseFont.getFontData(); + FontData data = fontDatas[0]; + font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); + m_fontToBoldFontMap.put(baseFont, font); + } + return font; + } + + /** + * Dispose all of the cached {@link Font}'s. + */ + public static void disposeFonts() + { + // clear fonts + for (Font font : m_fontMap.values()) + { + font.dispose(); + } + m_fontMap.clear(); + // clear bold fonts + for (Font font : m_fontToBoldFontMap.values()) + { + font.dispose(); + } + m_fontToBoldFontMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Cursor + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps IDs to cursors. + */ + private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); + + /** + * Returns the system cursor matching the specific ID. + * + * @param id + * int The ID value for the cursor + * @return Cursor The system cursor matching the specific ID + */ + public static Cursor getCursor(int id) + { + Integer key = Integer.valueOf(id); + Cursor cursor = m_idToCursorMap.get(key); + if (cursor == null) + { + cursor = new Cursor(Display.getDefault(), id); + m_idToCursorMap.put(key, cursor); + } + return cursor; + } + + /** + * Dispose all of the cached cursors. + */ + public static void disposeCursors() + { + for (Cursor cursor : m_idToCursorMap.values()) + { + cursor.dispose(); + } + m_idToCursorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeImages(); + disposeFonts(); + disposeCursors(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/copyExampleLib.ant b/plugins/org.eclipse.emf.cdo.examples.installer/copyExampleLib.ant index 968ba5cca3..06c9e53252 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/copyExampleLib.ant +++ b/plugins/org.eclipse.emf.cdo.examples.installer/copyExampleLib.ant @@ -27,6 +27,7 @@ <fileset dir="@{project}"> <exclude name=".externalToolBuilders/" /> <exclude name="database/" /> + <exclude name="nodes/*/db/" /> <exclude name="bin/" /> <exclude name=".settings/org.eclipse.mylyn*" /> <exclude name=".settings/org.eclipse.pde.api.tools.prefs" /> diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/CDOOfflineExample.launch b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/CDOOfflineExample.launch new file mode 100644 index 0000000000..da3877efdb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/CDOOfflineExample.launch @@ -0,0 +1,756 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> +<booleanAttribute key="append.args" value="true"/> +<stringAttribute key="application" value="org.eclipse.emf.cdo.examples.client.offline.application"/> +<booleanAttribute key="askclear" value="true"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="org.eclipse.ui"/> +<booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="false"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CDOOfflineExample"/> +<booleanAttribute key="default" value="false"/> +<booleanAttribute key="includeOptional" value="false"/> +<stringAttribute key="location" value="${workspace_loc}/../CDOOfflineExample.rt"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> +<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms1024m -Xmx1024m -Dnode.manager.root=${resource_loc:/org.eclipse.emf.cdo.examples.client.offline/nodes}"/> +<booleanAttribute key="pde.generated.config" value="false"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.b3.cli.product"/> +<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.emf.common*2.9.0.v20121012-0206@default:default,org.eclipse.emf.ecore*2.9.0.v20121012-0206@default:default,org.eclipse.emf.ecore.change*2.8.0.v20121012-0206@default:default,org.eclipse.emf.ecore.xmi*2.9.0.v20121012-0206@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.nebula.widgets.oscilloscope@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.h2@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.examples.client.offline@default:default,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.server.admin@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.ui.shared@default:default,org.eclipse.net4j.util.ui@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/> +<stringAttribute key="selected_workspace_plugins" value="com.ibm.icu@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.emf.common*2.9.0.v20121012-0206@default:default,org.eclipse.emf.ecore*2.9.0.v20121012-0206@default:default,org.eclipse.emf.ecore.change*2.8.0.v20121012-0206@default:default,org.eclipse.emf.ecore.xmi*2.9.0.v20121012-0206@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.nebula.widgets.oscilloscope@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.h2@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.examples.client.offline@default:default,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.server.admin@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.ui.shared@default:default,org.eclipse.net4j.util.ui@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/> +<booleanAttribute key="show_selected_only" value="false"/> +<booleanAttribute key="tracing" value="false"/> +<mapAttribute key="tracingOptions"> +<mapEntry key="org.eclipse.birt.chart.device.extension/debug" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/extension.i18n" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/image" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/plugin" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/swing" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/swt" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/trace" value="false"/> +<mapEntry key="org.eclipse.birt.chart.device.extension/util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/aggregate" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/datafeed" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/debug" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/engine.extension.i18n" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/plugin" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/render" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine.extension/trace" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/aggregate" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/computation" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/computation.withaxes" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/computation.withoutaxes" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/datafeed" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/debug" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/device" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/engine.i18n" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/event" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/exception" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/factory" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/internal" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/internal.computations" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/internal.factory" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/internal.script" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/log" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/log.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.attribute" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.attribute.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.attribute.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.component" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.component.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.component.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.data" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.data.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.data.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.layout" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.layout.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.layout.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.prefs" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.type" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.type.impl" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.type.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/model.util" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/plugin" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/render" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/script" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/style" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/trace" value="false"/> +<mapEntry key="org.eclipse.birt.chart.engine/util" value="false"/> +<mapEntry key="org.eclipse.birt.core/debug" value="false"/> +<mapEntry key="org.eclipse.core.contenttype/debug" value="false"/> +<mapEntry key="org.eclipse.core.expressions/debug/TypeExtensionManager" value="false"/> +<mapEntry key="org.eclipse.core.expressions/tracePropertyResolving" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs/beginend" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs/errorondeadlock" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs/locks" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs/shutdown" value="false"/> +<mapEntry key="org.eclipse.core.jobs/jobs/timing" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/interrupt" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/needbuildstack" value="false"/> +<mapEntry key="org.eclipse.core.resources/build/stacktrace" value="false"/> +<mapEntry key="org.eclipse.core.resources/contenttype" value="false"/> +<mapEntry key="org.eclipse.core.resources/contenttype/cache" value="false"/> +<mapEntry key="org.eclipse.core.resources/debug" value="false"/> +<mapEntry key="org.eclipse.core.resources/history" value="false"/> +<mapEntry key="org.eclipse.core.resources/natures" value="false"/> +<mapEntry key="org.eclipse.core.resources/perf/builders" value="10000"/> +<mapEntry key="org.eclipse.core.resources/perf/listeners" value="500"/> +<mapEntry key="org.eclipse.core.resources/perf/save.participants" value="500"/> +<mapEntry key="org.eclipse.core.resources/perf/snapshot" value="1000"/> +<mapEntry key="org.eclipse.core.resources/preferences" value="false"/> +<mapEntry key="org.eclipse.core.resources/refresh" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/> +<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/> +<mapEntry key="org.eclipse.core.resources/save" value="false"/> +<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/> +<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/> +<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/> +<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/> +<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/> +<mapEntry key="org.eclipse.core.resources/strings" value="false"/> +<mapEntry key="org.eclipse.core.runtime/compatibility/debug" value="false"/> +<mapEntry key="org.eclipse.core.runtime/debug" value="false"/> +<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/> +<mapEntry key="org.eclipse.core.runtime/perf" value="false"/> +<mapEntry key="org.eclipse.core.runtime/perf/success" value="false"/> +<mapEntry key="org.eclipse.core.runtime/preferences/plugin" value="false"/> +<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/> +<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/> +<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/> +<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/> +<mapEntry key="org.eclipse.debug.core/debug" value="false"/> +<mapEntry key="org.eclipse.debug.core/debug/commands" value="false"/> +<mapEntry key="org.eclipse.debug.core/debug/events" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/breadcrumb" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/contextlaunching" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/launchhistory" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/memory/dynamicLoading" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/breakpointDeltas" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/contentProvider" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/deltas" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/model" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/presentationId" value=""/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/stateSaveRestore" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/updateSequence" value="false"/> +<mapEntry key="org.eclipse.debug.ui/debug/viewers/viewer" value="false"/> +<mapEntry key="org.eclipse.egit.core/debug" value="false"/> +<mapEntry key="org.eclipse.egit.core/debug/core" value="false"/> +<mapEntry key="org.eclipse.egit.core/debug/core/indexdiffcache" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/quickdiff" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/repochangescanner" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/ui" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/ui/decoration" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/ui/historyview" value="false"/> +<mapEntry key="org.eclipse.egit.ui/debug/ui/repositoriesview" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.admin/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.admin/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common.db/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common/debug.id" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common/debug.revision" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.common/perf" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.common/perf.revision" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.common/perf.revision.reading" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.common/perf.revision.writing" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.compare/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.ecore.editor.dawn/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.examples.acore.diagram/debug" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.examples.acore.diagram/debug/visualID" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.tests/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.tests/debug.object" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.ui/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.ui/debug.object" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.util/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn.util/debug.object" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.object" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.object.statemachine" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.object.store" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.session" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.session.model" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.session.revision" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.view" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.view.audit" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/debug.view.transaction" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.dawn/load.resource.before.notification" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.efs/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.examples/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.explorer/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.location/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.net4j/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.net4j/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.net4j/perf" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.net4j/perf.revision" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.net4j/perf.revision.loading" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.security/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.admin/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.admin/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.db/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.hibernate/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.lissome/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.lissome/debug.index" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.lissome/debug.journal" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.lissome/debug.vob" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.mongodb/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.repository" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.resource" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.revision" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.session" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.store" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.transaction" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.net4j/debug.types" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.objectivity/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server.product/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.repository" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.resource" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.revision" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.session" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.store" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.transaction" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.server/debug.types" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.team/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.all/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.db/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.lissome/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.mongodb/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.objectivity/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests.ui/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.tests/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.transfer.repository/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.transfer.ui/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.transfer.workspace.ui/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.transfer.workspace/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.transfer/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.admin/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.compare/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.efs/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.ide/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.location/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.shared/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.team/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui.workspace/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.ui/test" value="false"/> +<mapEntry key="org.eclipse.emf.cdo.workspace.efs/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo.workspace/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.object" value="false"/> +<mapEntry key="org.eclipse.emf.cdo/debug.object.statemachine" value="false"/> +<mapEntry key="org.eclipse.emf.cdo/debug.object.store" value="false"/> +<mapEntry key="org.eclipse.emf.cdo/debug.session" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.session.model" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.session.revision" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.view" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.view.audit" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/debug.view.transaction" value="true"/> +<mapEntry key="org.eclipse.emf.cdo/load.resource.before.notification" value="false"/> +<mapEntry key="org.eclipse.emf.mint/debug" value="false"/> +<mapEntry key="org.eclipse.emf.mint/debug/MemberAnnotationManager" value="false"/> +<mapEntry key="org.eclipse.emf.mint/debug/MemberAnnotationManager/CacheCleaner" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug" value="true"/> +<mapEntry key="org.eclipse.emf.transaction/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug/locking" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.emf.transaction/debug/transactions" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug" value="true"/> +<mapEntry key="org.eclipse.emf.validation/debug/cache" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/constraints" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/constraints/disabled" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/constraints/evaluation" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/listeners" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/parsers" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/providers" value="false"/> +<mapEntry key="org.eclipse.emf.validation/debug/xml" value="false"/> +<mapEntry key="org.eclipse.emf.workspace/debug" value="true"/> +<mapEntry key="org.eclipse.emf.workspace/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.emf.workspace/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.emf.workspace/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.emf.workspace/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.equinox.ds/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.ds/instantiate_all" value="false"/> +<mapEntry key="org.eclipse.equinox.ds/performance" value="false"/> +<mapEntry key="org.eclipse.equinox.ds/print_on_console" value="false"/> +<mapEntry key="org.eclipse.equinox.p2.engine/certificatechecker/unsigned" value="false"/> +<mapEntry key="org.eclipse.equinox.p2.engine/certificatechecker/untrusted" value="false"/> +<mapEntry key="org.eclipse.equinox.p2.engine/engine/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.p2.engine/enginesession/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.p2.engine/profileregistry/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.preferences/general" value="false"/> +<mapEntry key="org.eclipse.equinox.preferences/get" value="false"/> +<mapEntry key="org.eclipse.equinox.preferences/set" value="false"/> +<mapEntry key="org.eclipse.equinox.registry/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.registry/debug/events" value="false"/> +<mapEntry key="org.eclipse.equinox.security.ui/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.security.ui/debug/storage" value="false"/> +<mapEntry key="org.eclipse.equinox.security/debug" value="false"/> +<mapEntry key="org.eclipse.equinox.security/debug/loginFramework" value="false"/> +<mapEntry key="org.eclipse.gmf.common/debug/organizeImports" value="false"/> +<mapEntry key="org.eclipse.gmf.common/reconciler/traceCrossRefUpdate" value="false"/> +<mapEntry key="org.eclipse.gmf.common/reconciler/traceDecision" value="false"/> +<mapEntry key="org.eclipse.gmf.common/reconciler/traceDecision/features" value="false"/> +<mapEntry key="org.eclipse.gmf.common/reconciler/traceMatches" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/commands/admin" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/commands/execute" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/commands/redo" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/commands/undo" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/plugin/ondemand/loading" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/services/activate" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/services/config" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.core/debug/services/execute" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.action/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.action/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.action/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.action/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.action/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/actions/admin" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/actions/run" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.printing/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services.action/debug/services/config" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui.services/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/actions/admin" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/actions/repeat" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/actions/run" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.common.ui/debug/resource/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui.actions/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui.actions/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui.actions/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui.actions/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui.actions/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/dnd/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/filter/canonical" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/filter/events" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/filter/persistencemgr" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.diagram.ui/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug/dnd/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.figures/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug/dnd/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render.awt/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug/dnd/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.draw2d.ui.render/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.clipboard.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.clipboard.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.clipboard.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.clipboard.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.clipboard.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug/events/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.commands.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/events/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.core/debug/resources" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.type.core/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.type.core/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.type.core/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.type.core/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.type.core/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui.properties/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui.properties/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui.properties/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui.properties/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui.properties/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.emf.ui/debug/model/operations" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug/dnd/tracing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.gef.ui/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.notation.providers/debug" value="true"/> +<mapEntry key="org.eclipse.gmf.runtime.notation.providers/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.notation.providers/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.notation.providers/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.gmf.runtime.notation.providers/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.gmf.validate/debug" value="false"/> +<mapEntry key="org.eclipse.gmf.validate/debug/cache" value="false"/> +<mapEntry key="org.eclipse.gmf.validate/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.gmf.validate/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.gmf.validate/debug/meta/definitions" value="false"/> +<mapEntry key="org.eclipse.help.ui/debug" value="true"/> +<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser" value="false"/> +<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser/inprocess" value="false"/> +<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/> +<mapEntry key="org.eclipse.help.webapp/debug" value="true"/> +<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/> +<mapEntry key="org.eclipse.help/debug" value="true"/> +<mapEntry key="org.eclipse.help/debug/context" value="false"/> +<mapEntry key="org.eclipse.help/debug/search" value="false"/> +<mapEntry key="org.eclipse.help/debug/toc" value="false"/> +<mapEntry key="org.eclipse.jdt.apt.core/debug" value="false"/> +<mapEntry key="org.eclipse.jdt.apt.core/debug/compilationEnv" value="false"/> +<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFileMaps" value="false"/> +<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFiles" value="false"/> +<mapEntry key="org.eclipse.jdt.apt.pluggable.core/debug" value="false"/> +<mapEntry key="org.eclipse.jdt.core.manipulation/debug" value="true"/> +<mapEntry key="org.eclipse.jdt.core/debug" value="true"/> +<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/builder/stats" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/cpresolution/advanced" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/cpresolution/failure" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/formatter" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/indexmanager/advanced" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/javadelta/verbose" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/javamodel/cache" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/resolution" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/sourcemapper" value="false"/> +<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/> +<mapEntry key="org.eclipse.jdt.core/perf/completion" value="300"/> +<mapEntry key="org.eclipse.jdt.core/perf/containerinitializer" value="5000"/> +<mapEntry key="org.eclipse.jdt.core/perf/javadeltalistener" value="500"/> +<mapEntry key="org.eclipse.jdt.core/perf/reconcile" value="1000"/> +<mapEntry key="org.eclipse.jdt.core/perf/selection" value="300"/> +<mapEntry key="org.eclipse.jdt.core/perf/variableinitializer" value="5000"/> +<mapEntry key="org.eclipse.jdt.debug/debug" value="false"/> +<mapEntry key="org.eclipse.jdt.debug/debug/astEvaluations" value="false"/> +<mapEntry key="org.eclipse.jdt.debug/debug/astEvaluations/callingThreads" value="false"/> +<mapEntry key="org.eclipse.jdt.debug/debug/jdiEvents" value="false"/> +<mapEntry key="org.eclipse.jdt.debug/debug/jdiRequestTimes" value="false"/> +<mapEntry key="org.eclipse.jdt.launching/debug" value="false"/> +<mapEntry key="org.eclipse.jdt.launching/debug/classpath/jreContainer" value="false"/> +<mapEntry key="org.eclipse.jdt.ui/debug" value="true"/> +<mapEntry key="org.eclipse.jdt.ui/debug/ASTProvider" value="false"/> +<mapEntry key="org.eclipse.jdt.ui/debug/BreadcrumbItemDropDown" value="false"/> +<mapEntry key="org.eclipse.jdt.ui/debug/ResultCollector" value="false"/> +<mapEntry key="org.eclipse.jdt.ui/debug/TypeConstraints" value="false"/> +<mapEntry key="org.eclipse.jdt.ui/perf/content_assist/extensions" value="1000"/> +<mapEntry key="org.eclipse.jdt.ui/perf/content_assist_sorters/extensions" value=""/> +<mapEntry key="org.eclipse.jdt.ui/perf/explorer/RefactorActionGroup" value="150"/> +<mapEntry key="org.eclipse.jdt.ui/perf/explorer/createPartControl" value="1300"/> +<mapEntry key="org.eclipse.jdt.ui/perf/explorer/makeActions" value="1000"/> +<mapEntry key="org.eclipse.jdt.ui/perf/search/participants" value="300"/> +<mapEntry key="org.eclipse.jface.text.source/debug/RevisionRulerColumn" value="false"/> +<mapEntry key="org.eclipse.jface.text/assert/TextSelection/validConstructorArguments" value="false"/> +<mapEntry key="org.eclipse.jface.text/debug/AbstractInformationControlManager" value="false"/> +<mapEntry key="org.eclipse.jface.text/debug/AnnotationPainter" value="false"/> +<mapEntry key="org.eclipse.jface.text/debug/ContentAssistSubjectAdapters" value="false"/> +<mapEntry key="org.eclipse.jface.text/debug/FastPartitioner/PositionCache" value="false"/> +<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/checkConditions" value="300"/> +<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/createChanges" value="300"/> +<mapEntry key="org.eclipse.mat.api/debug" value="false"/> +<mapEntry key="org.eclipse.mat.dtfj/debug" value="false"/> +<mapEntry key="org.eclipse.mat.dtfj/debug/verbose" value="false"/> +<mapEntry key="org.eclipse.mat.dtfj/errorCount" value="20"/> +<mapEntry key="org.eclipse.mat.hprof/debug" value="false"/> +<mapEntry key="org.eclipse.mat.hprof/debug/parser" value="false"/> +<mapEntry key="org.eclipse.mat.parser/debug" value="false"/> +<mapEntry key="org.eclipse.mat.report/debug" value="false"/> +<mapEntry key="org.eclipse.net4j.buddies.chat.ui/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.buddies.chat/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.buddies.common/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.buddies.server/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.buddies.ui/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.buddies/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.derby/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.derby/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db.h2/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.h2/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db.hsqldb/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.hsqldb/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db.mysql/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.mysql/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db.oracle/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.oracle/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db.postgresql/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db.postgresql/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.db/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.db/debug.sql" value="true"/> +<mapEntry key="org.eclipse.net4j.debug/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.examples/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.http.common/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.http.server/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.http/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.admin/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.admin/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.server.jdbc/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.server/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.server/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.net4j.jms.server/debug.store" value="true"/> +<mapEntry key="org.eclipse.net4j.jms/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.jms/debug.protocol" value="true"/> +<mapEntry key="org.eclipse.net4j.jvm/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.tcp/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.tests/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.ui.shared/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.ui/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.util.ui/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug.concurrency" value="false"/> +<mapEntry key="org.eclipse.net4j.util/debug.lifecycle" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug.lifecycle.dump" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug.om" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug.om.monitor" value="true"/> +<mapEntry key="org.eclipse.net4j.util/debug.registry" value="true"/> +<mapEntry key="org.eclipse.net4j/debug" value="true"/> +<mapEntry key="org.eclipse.net4j/debug.acceptor" value="true"/> +<mapEntry key="org.eclipse.net4j/debug.buffer" value="true"/> +<mapEntry key="org.eclipse.net4j/debug.buffer.stream" value="false"/> +<mapEntry key="org.eclipse.net4j/debug.channel" value="true"/> +<mapEntry key="org.eclipse.net4j/debug.connector" value="true"/> +<mapEntry key="org.eclipse.net4j/debug.signal" value="true"/> +<mapEntry key="org.eclipse.net4j/open.channel.timeout" value="10000"/> +<mapEntry key="org.eclipse.net4j/set.signal.thread.name" value="false"/> +<mapEntry key="org.eclipse.ocl/debug" value="true"/> +<mapEntry key="org.eclipse.ocl/debug/evaluation" value="false"/> +<mapEntry key="org.eclipse.ocl/debug/exceptions/catching" value="false"/> +<mapEntry key="org.eclipse.ocl/debug/exceptions/throwing" value="false"/> +<mapEntry key="org.eclipse.ocl/debug/methods/entering" value="false"/> +<mapEntry key="org.eclipse.ocl/debug/methods/exiting" value="false"/> +<mapEntry key="org.eclipse.ocl/debug/parsing" value="false"/> +<mapEntry key="org.eclipse.osgi/debug" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/bundleTime" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/events" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/filter" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/loader" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/manifest" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/messageBundles" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/objectPool/adds" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/objectPool/dups" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/packageadmin" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/security" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/services" value="false"/> +<mapEntry key="org.eclipse.osgi/debug/startlevel" value="false"/> +<mapEntry key="org.eclipse.osgi/defaultprofile/buffersize" value="256"/> +<mapEntry key="org.eclipse.osgi/defaultprofile/logfilename" value=""/> +<mapEntry key="org.eclipse.osgi/defaultprofile/logsynchronously" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/converter/debug" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/cachedmanifest" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/location" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin" value="false"/> +<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver" value="false"/> +<mapEntry key="org.eclipse.osgi/monitor/activation" value="false"/> +<mapEntry key="org.eclipse.osgi/monitor/classes" value="false"/> +<mapEntry key="org.eclipse.osgi/monitor/resources" value="false"/> +<mapEntry key="org.eclipse.osgi/profile/benchmark" value="false"/> +<mapEntry key="org.eclipse.osgi/profile/debug" value="false"/> +<mapEntry key="org.eclipse.osgi/profile/impl" value="org.eclipse.osgi.internal.profile.DefaultProfileLogger"/> +<mapEntry key="org.eclipse.osgi/profile/startup" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/cycles" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/debug" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/generics" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/imports" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/requires" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/uses" value="false"/> +<mapEntry key="org.eclipse.osgi/resolver/wiring" value="false"/> +<mapEntry key="org.eclipse.osgi/trace/activation" value="false"/> +<mapEntry key="org.eclipse.osgi/trace/classLoading" value="false"/> +<mapEntry key="org.eclipse.osgi/trace/filename" value="runtime.traces"/> +<mapEntry key="org.eclipse.osgi/trace/filters" value="trace.properties"/> +<mapEntry key="org.eclipse.pde.api.tools/debug" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/apianalyzer" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/apidescription" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/apifilterstore" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/apiprofile" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/builder" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/classfilevisitor" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/delta" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/descriptor/framework" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/pluginworkspacecomponent" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/profilemanager" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/search" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/tagscanner" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/usereportconverter" value="false"/> +<mapEntry key="org.eclipse.pde.api.tools/debug/workspacedeltaprocessor" value="false"/> +<mapEntry key="org.eclipse.pde.build/debug" value="false"/> +<mapEntry key="org.eclipse.pde.core/cache" value="false"/> +<mapEntry key="org.eclipse.pde.core/classpath" value="false"/> +<mapEntry key="org.eclipse.pde.core/debug" value="true"/> +<mapEntry key="org.eclipse.pde.core/target/profile" value="false"/> +<mapEntry key="org.eclipse.pde.core/validation" value="false"/> +<mapEntry key="org.eclipse.team.core/backgroundevents" value="false"/> +<mapEntry key="org.eclipse.team.core/debug" value="false"/> +<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/> +<mapEntry key="org.eclipse.team.core/streams" value="false"/> +<mapEntry key="org.eclipse.team.core/threading" value="false"/> +<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/> +<mapEntry key="org.eclipse.team.cvs.core/debug" value="false"/> +<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/> +<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/> +<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/> +<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/> +<mapEntry key="org.eclipse.ui.browser/debug" value="false"/> +<mapEntry key="org.eclipse.ui.ide/debug" value="false"/> +<mapEntry key="org.eclipse.ui.ide/debug/gc" value="false"/> +<mapEntry key="org.eclipse.ui.ide/debug/internalerror/openDialog" value="false"/> +<mapEntry key="org.eclipse.ui.ide/debug/markers" value="false"/> +<mapEntry key="org.eclipse.ui.ide/debug/undomonitor" value="false"/> +<mapEntry key="org.eclipse.ui.intro.universal/debug" value="true"/> +<mapEntry key="org.eclipse.ui.intro.universal/trace/logInfo" value="true"/> +<mapEntry key="org.eclipse.ui.intro.universal/trace/logPerformance" value="false"/> +<mapEntry key="org.eclipse.ui.intro/debug" value="true"/> +<mapEntry key="org.eclipse.ui.intro/debug/toolbar" value="false"/> +<mapEntry key="org.eclipse.ui.intro/flags/noBrowser" value="false"/> +<mapEntry key="org.eclipse.ui.intro/trace/logInfo" value="true"/> +<mapEntry key="org.eclipse.ui.intro/trace/logPerformance" value="false"/> +<mapEntry key="org.eclipse.ui.intro/trace/printHTML" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug/dnd" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug/resolution" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug/setup" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug/sort" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/debug/viewermap" value="false"/> +<mapEntry key="org.eclipse.ui.navigator/perf/explorer/createPartControl" value="1300"/> +<mapEntry key="org.eclipse.ui.workbench/debug" value="false"/> +<mapEntry key="org.eclipse.ui/debug" value="false"/> +<mapEntry key="org.eclipse.ui/debug/contributions" value="false"/> +<mapEntry key="org.eclipse.ui/debug/declaredImages" value="false"/> +<mapEntry key="org.eclipse.ui/debug/job.stale" value="false"/> +<mapEntry key="org.eclipse.ui/debug/showAllJobs" value="false"/> +<mapEntry key="org.eclipse.ui/debug/swtdebug" value="true"/> +<mapEntry key="org.eclipse.ui/debug/swtdebugglobal" value="false"/> +<mapEntry key="org.eclipse.ui/debug/workingSets" value="false"/> +<mapEntry key="org.eclipse.ui/experimental/menus" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPropertyChangeListener" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPartReference" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPageListener" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2" value="false"/> +<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPerspectiveListener" value="false"/> +<mapEntry key="org.eclipse.ui/perf/contentTypes" value="200"/> +<mapEntry key="org.eclipse.ui/perf/page.listeners" value="200"/> +<mapEntry key="org.eclipse.ui/perf/part.activate" value="200"/> +<mapEntry key="org.eclipse.ui/perf/part.control" value="800"/> +<mapEntry key="org.eclipse.ui/perf/part.create" value="800"/> +<mapEntry key="org.eclipse.ui/perf/part.init" value="800"/> +<mapEntry key="org.eclipse.ui/perf/part.input" value="200"/> +<mapEntry key="org.eclipse.ui/perf/part.listeners" value="200"/> +<mapEntry key="org.eclipse.ui/perf/perspective.create" value="800"/> +<mapEntry key="org.eclipse.ui/perf/perspective.listeners" value="200"/> +<mapEntry key="org.eclipse.ui/perf/perspective.switch" value="800"/> +<mapEntry key="org.eclipse.ui/perf/showHeapStatus" value="true"/> +<mapEntry key="org.eclipse.ui/perf/uijob" value="200"/> +<mapEntry key="org.eclipse.ui/perf/workbench.restore" value="30000"/> +<mapEntry key="org.eclipse.ui/perf/workbench.start" value="45000"/> +<mapEntry key="org.eclipse.ui/trace/commands" value="false"/> +<mapEntry key="org.eclipse.ui/trace/contexts" value="false"/> +<mapEntry key="org.eclipse.ui/trace/contexts.performance" value="false"/> +<mapEntry key="org.eclipse.ui/trace/contexts.verbose" value="false"/> +<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/> +<mapEntry key="org.eclipse.ui/trace/handlers" value="false"/> +<mapEntry key="org.eclipse.ui/trace/handlers.performance" value="false"/> +<mapEntry key="org.eclipse.ui/trace/handlers.verbose" value="false"/> +<mapEntry key="org.eclipse.ui/trace/handlers.verbose.commandId" value=""/> +<mapEntry key="org.eclipse.ui/trace/keyBindings" value="false"/> +<mapEntry key="org.eclipse.ui/trace/keyBindings.verbose" value="false"/> +<mapEntry key="org.eclipse.ui/trace/multipageeditor" value="false"/> +<mapEntry key="org.eclipse.ui/trace/operations" value="false"/> +<mapEntry key="org.eclipse.ui/trace/operations.verbose" value="false"/> +<mapEntry key="org.eclipse.ui/trace/perspectives" value="false"/> +<mapEntry key="org.eclipse.ui/trace/sources" value="false"/> +<mapEntry key="org.eclipse.update.configurator/debug" value="false"/> +<mapEntry key="org.eclipse.update.core/debug" value="true"/> +<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/install" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/type" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/> +<mapEntry key="org.eclipse.update.core/debug/web" value="false"/> +</mapAttribute> +<booleanAttribute key="useCustomFeatures" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="false"/> +<booleanAttribute key="usefeatures" value="false"/> +</launchConfiguration> diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF index 58d7581ce8..946a6439ae 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/META-INF/MANIFEST.MF @@ -13,8 +13,12 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.emf.cdo.server.admin;bundle-version="[4.1.0,5.0.0)", org.eclipse.emf.cdo.server.db;bundle-version="[4.0.0,5.0.0)", org.eclipse.emf.cdo.server.net4j;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)", org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)", - org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)" + org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)", + org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)" Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)" Bundle-ClassPath: . -Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.0";x-internal:=true +Export-Package: org.eclipse.emf.cdo.examples.client.offline;version="4.2.0";x-internal:=true, + org.eclipse.emf.cdo.examples.client.offline.nodes;version="4.2.0";x-internal:=true, + org.eclipse.wb.swt;version="4.2.0";x-internal:=true diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Client.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Client.gif Binary files differnew file mode 100644 index 0000000000..e3ecc5535c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Client.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverMonitor.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverMonitor.gif Binary files differnew file mode 100644 index 0000000000..4e99fade4b --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverMonitor.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverRepository.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverRepository.gif Binary files differnew file mode 100644 index 0000000000..bb1088c319 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/FailoverRepository.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Folder.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Folder.gif Binary files differnew file mode 100644 index 0000000000..152ce470c5 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/Folder.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NodeManager.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NodeManager.gif Binary files differnew file mode 100644 index 0000000000..3a9dadbf25 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NodeManager.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NormalRepository.gif b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NormalRepository.gif Binary files differnew file mode 100644 index 0000000000..d678903420 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/icons/NormalRepository.gif diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client1/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client1/node.properties new file mode 100644 index 0000000000..29360095ab --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client1/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:12:19 CET 2012 +Name=client1 +Type=Client +Server=repo1 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client2/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client2/node.properties new file mode 100644 index 0000000000..b0be5b0e84 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client2/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:13:32 CET 2012 +Name=client2 +Type=Client +Server=repo2 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client3/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client3/node.properties new file mode 100644 index 0000000000..74cc76d194 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/client3/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 11:26:41 CET 2012 +Name=client3 +Type=Client +Server=group2 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover1/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover1/node.properties new file mode 100644 index 0000000000..f569e474ab --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover1/node.properties @@ -0,0 +1,6 @@ +#Node Settings +#Sat Nov 03 10:14:49 CET 2012 +Name=group1-failover1 +Type=FailoverRepository +Monitor=group1 +Port=3011 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover2/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover2/node.properties new file mode 100644 index 0000000000..fcd33525fa --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1-failover2/node.properties @@ -0,0 +1,6 @@ +#Node Settings +#Sat Nov 03 10:15:06 CET 2012 +Name=group1-failover2 +Type=FailoverRepository +Monitor=group1 +Port=3012 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1/node.properties new file mode 100644 index 0000000000..272fb39667 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group1/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:14:04 CET 2012 +Name=group1 +Type=FailoverMonitor +Port=2041 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover1/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover1/node.properties new file mode 100644 index 0000000000..3a5752900a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover1/node.properties @@ -0,0 +1,6 @@ +#Node Settings +#Sat Nov 03 10:15:19 CET 2012 +Name=group2-failover1 +Type=FailoverRepository +Monitor=group2 +Port=3021 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover2/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover2/node.properties new file mode 100644 index 0000000000..5c8b51abf4 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2-failover2/node.properties @@ -0,0 +1,6 @@ +#Node Settings +#Sat Nov 03 10:15:25 CET 2012 +Name=group2-failover2 +Type=FailoverRepository +Monitor=group2 +Port=3022 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2/node.properties new file mode 100644 index 0000000000..5f195e93ce --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/group2/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:14:10 CET 2012 +Name=group2 +Type=FailoverMonitor +Port=2042 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo1/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo1/node.properties new file mode 100644 index 0000000000..29362b0ec1 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo1/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:12:02 CET 2012 +Name=repo1 +Type=NormalRepository +Port=2036 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo2/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo2/node.properties new file mode 100644 index 0000000000..3810bb3813 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo2/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 10:12:11 CET 2012 +Name=repo2 +Type=NormalRepository +Port=2037 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo3/node.properties b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo3/node.properties new file mode 100644 index 0000000000..256fe644f3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/nodes/repo3/node.properties @@ -0,0 +1,5 @@ +#Node Settings +#Sat Nov 03 15:28:11 CET 2012 +Name=repo3 +Type=NormalRepository +Port=2038 diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/plugin.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/plugin.xml index bd59b013ff..ca36ac64dc 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/plugin.xml @@ -26,32 +26,33 @@ <extension point="org.eclipse.ui.perspectives"> <perspective - name="Perspective" - class="org.eclipse.emf.cdo.examples.client.offline.Perspective" - id="org.eclipse.emf.cdo.examples.client.offline.Perspective"> - </perspective> + name="Normal Repository" + class="org.eclipse.emf.cdo.examples.client.offline.NormalRepositoryPerspective" + id="org.eclipse.emf.cdo.examples.client.offline.NormalRepositoryPerspective"/> + <perspective + name="Failover Repository" + class="org.eclipse.emf.cdo.examples.client.offline.FailoverRepositoryPerspective" + id="org.eclipse.emf.cdo.examples.client.offline.FailoverRepositoryPerspective"/> + <perspective + name="Failover Monitor" + class="org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorPerspective" + id="org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorPerspective"/> </extension> - <!-- <extension point="org.eclipse.ui.views"> - <category - id="org.myzilla.app.category" - name="Myzilla"> - </category> <view - category="org.myzilla.app.category" - class="org.myzilla.app.MyzillaNavigatorView" - id="org.myzilla.app.navigator" - name="Navigator"> - </view> + class="org.eclipse.emf.cdo.examples.client.offline.NormalRepositoryView" + id="org.eclipse.emf.cdo.examples.client.offline.NormalRepositoryView" + name="Normal Repository"/> + <view + class="org.eclipse.emf.cdo.examples.client.offline.FailoverRepositoryView" + id="org.eclipse.emf.cdo.examples.client.offline.FailoverRepositoryView" + name="Failover Repository"/> <view - category="org.myzilla.app.category" - class="org.myzilla.app.MyzillaDetailsView" - id="org.myzilla.app.details" - name="Details"> - </view> + class="org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView" + id="org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView" + name="Failover Monitor"/> </extension> - --> </plugin> diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/AbstractView.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/AbstractView.java new file mode 100644 index 0000000000..6e44db11b7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/AbstractView.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +import org.eclipse.net4j.util.StringUtil; +import org.eclipse.net4j.util.container.IContainer; +import org.eclipse.net4j.util.event.IEvent; +import org.eclipse.net4j.util.ui.views.ContainerItemProvider; +import org.eclipse.net4j.util.ui.views.ItemProvider; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.part.ViewPart; +import org.eclipse.wb.swt.SWTResourceManager; + +/** + * @author Eike Stepper + */ +public abstract class AbstractView<T extends IContainer<?>> extends ViewPart +{ + private final Class<T> objectType; + + private T object; + + private Text events; + + public AbstractView(Class<T> objectType) + { + this.objectType = objectType; + object = Application.NODE.getObject(objectType); + } + + public Class<T> getObjectType() + { + return objectType; + } + + public T getObject() + { + return object; + } + + @Override + public void createPartControl(Composite parent) + { + Composite container = new Composite(parent, SWT.NONE); + container.setLayout(new FillLayout(SWT.HORIZONTAL)); + + SashForm sash = new SashForm(container, SWT.SMOOTH | SWT.VERTICAL); + + @SuppressWarnings("unchecked") + ItemProvider<T> itemProvider = (ItemProvider<T>)new ContainerItemProvider<IContainer<Object>>() + { + @Override + protected void handleElementEvent(final IEvent event) + { + addEvent(event); + } + }; + + createPane(sash, object, itemProvider); + + events = new Text(sash, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); + events.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + + sash.setWeights(new int[] { 1, 1 }); + + createActions(); + initializeToolBar(getViewSite().getActionBars().getToolBarManager()); + initializeMenu(getViewSite().getActionBars().getMenuManager()); + } + + protected void addEvent(final IEvent event) + { + getSite().getShell().getDisplay().asyncExec(new Runnable() + { + public void run() + { + String text = events.getText(); + if (text.length() != 0) + { + text += StringUtil.NL; + } + + events.setText(text + event); + } + }); + } + + protected void createActions() + { + // Create the actions + } + + protected void initializeToolBar(IToolBarManager toolbarManager) + { + } + + protected void initializeMenu(IMenuManager menuManager) + { + } + + protected abstract void createPane(Composite parent, T object, ItemProvider<T> itemProvider); +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java index 1a9fb60ea8..f04b27ecf8 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Application.java @@ -10,35 +10,91 @@ */ package org.eclipse.emf.cdo.examples.client.offline; +import org.eclipse.emf.cdo.examples.client.offline.nodes.Node; +import org.eclipse.emf.cdo.examples.client.offline.nodes.NodeManager; +import org.eclipse.emf.cdo.examples.client.offline.nodes.NodeManagerDialog; + import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PlatformUI; +import java.io.File; + /** * @author Eike Stepper */ public class Application implements IApplication { + public static final String PLUGIN_ID = "org.eclipse.emf.cdo.examples.client.offline"; + + private static final String ROOT_PROPERTY = "node.manager.root"; + + public static Node NODE; + public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { + String rootProperty = System.getProperty(ROOT_PROPERTY); + if (rootProperty == null) + { + System.err.println("Property not set: " + ROOT_PROPERTY); + return IApplication.EXIT_OK; + } + + NodeManager nodeManager = new NodeManager(new File(rootProperty)); + NodeManagerDialog dialog = new NodeManagerDialog(new Shell(), nodeManager); + if (dialog.open() != NodeManagerDialog.OK) + { + return IApplication.EXIT_OK; + } + + NODE = dialog.getCurrentNode(); + + BusyIndicator.showWhile(display, new Runnable() + { + public void run() + { + NODE.start(); + } + }); + int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } - - return IApplication.EXIT_OK; + } + catch (Exception ex) + { + ex.printStackTrace(); } finally { + if (NODE != null) + { + try + { + NODE.stop(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + NODE = null; + } + display.dispose(); } + + return IApplication.EXIT_OK; } public void stop() diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchAdvisor.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchAdvisor.java index 5321892860..f0ad0fb174 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchAdvisor.java +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchAdvisor.java @@ -19,8 +19,6 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; */ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - private static final String PERSPECTIVE_ID = "org.myzilla.app.perspective"; - @Override public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { @@ -30,6 +28,6 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor @Override public String getInitialWindowPerspectiveId() { - return PERSPECTIVE_ID; + return "org.eclipse.emf.cdo.examples.client.offline." + Application.NODE.getType().getTypeName() + "Perspective"; } } diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchWindowAdvisor.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchWindowAdvisor.java index 7b2c92968a..8afb233c24 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchWindowAdvisor.java +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/ApplicationWorkbenchWindowAdvisor.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.examples.client.offline; -import org.eclipse.swt.graphics.Point; import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; @@ -36,10 +35,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(1000, 500)); - configurer.setTitle("Myzilla"); - configurer.setShowCoolBar(false); - configurer.setShowMenuBar(false); - configurer.setShowStatusLine(false); + Application.NODE.getType().configureWindow(configurer); } + } diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorPerspective.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorPerspective.java new file mode 100644 index 0000000000..0ca58f7dc9 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorPerspective.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * @author Eike Stepper + */ +public class FailoverMonitorPerspective implements IPerspectiveFactory +{ + public void createInitialLayout(IPageLayout layout) + { + layout.setEditorAreaVisible(false); + layout.setFixed(true); + layout.addView(FailoverMonitorView.ID, IPageLayout.LEFT, 0.5f, IPageLayout.ID_EDITOR_AREA); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java new file mode 100644 index 0000000000..d458ca8037 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverMonitorView.java @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +import org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView.OScope.Channel; +import org.eclipse.emf.cdo.server.net4j.FailoverMonitor; +import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol; + +import org.eclipse.net4j.signal.SignalScheduledEvent; +import org.eclipse.net4j.util.container.ContainerEventAdapter; +import org.eclipse.net4j.util.container.IContainer; +import org.eclipse.net4j.util.event.IEvent; +import org.eclipse.net4j.util.event.IListener; +import org.eclipse.net4j.util.ui.views.ItemProvider; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; + +import java.io.ByteArrayInputStream; +import java.util.Random; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * @author Eike Stepper + */ +public class FailoverMonitorView extends AbstractView<FailoverMonitor> +{ + public static final String ID = "org.eclipse.emf.cdo.examples.client.offline.FailoverMonitorView"; //$NON-NLS-1$ + + public FailoverMonitorView() + { + super(FailoverMonitor.class); + } + + @Override + protected void createPane(Composite parent, FailoverMonitor monitor, ItemProvider<FailoverMonitor> itemProvider) + { + final OScope scope = new OScope(parent, SWT.NONE); + monitor.addListener(new ContainerEventAdapter<AgentProtocol>() + { + @Override + protected void onAdded(IContainer<AgentProtocol> monitor, final AgentProtocol agent) + { + final Channel channel = scope.getChannel(agent.getConnectorDescription()); + agent.addListener(new IListener() + { + public void notifyEvent(IEvent event) + { + if (event instanceof SignalScheduledEvent) + { + if (!scope.isDisposed()) + { + scope.getDisplay().asyncExec(new Runnable() + { + public void run() + { + if (!scope.isDisposed()) + { + channel.peak(); + } + } + }); + } + } + } + }); + } + }); + } + + @Override + public void setFocus() + { + } + + /** + * @author Eike Stepper + */ + public static class OScope extends Canvas implements Runnable, PaintListener, ControlListener + { + public static final int[] PEAK = { 25, 50, 100, 80, 100, 50, 25, 10, 5 }; + + private static final String INITIAL = "#INITIAL#"; + + private static final Random RANDOM = new Random(); + + private static final int[] BACKGROUND = { 255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 72, 0, 72, 0, + 0, 255, 254, 0, 19, 67, 114, 101, 97, 116, 101, 100, 32, 119, 105, 116, 104, 32, 71, 73, 77, 80, 255, 219, 0, + 67, 0, 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12, 8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, + 15, 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26, 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, + 36, 28, 30, 31, 30, 255, 219, 0, 67, 1, 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 255, 192, 0, 17, 8, 0, 20, 0, 20, 3, 1, 34, 0, + 2, 17, 1, 3, 17, 1, 255, 196, 0, 23, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 7, 255, 196, + 0, 34, 16, 0, 2, 2, 0, 5, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 2, 20, 33, 52, 84, 17, 115, 145, 178, + 209, 97, 255, 196, 0, 23, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 3, 255, 196, 0, 27, 17, + 0, 2, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 17, 33, 49, 81, 18, 255, 218, 0, 12, 3, 1, 0, 2, 17, + 3, 17, 0, 63, 0, 225, 37, 87, 118, 245, 59, 79, 217, 140, 212, 60, 24, 60, 226, 250, 83, 110, 196, 74, 10, 205, + 211, 133, 245, 141, 180, 155, 122, 106, 255, 0, 78, 77, 187, 88, 4, 164, 237, 96, 204, 5, 89, 168, 120, 48, + 121, 197, 244, 10, 223, 5, 233, 240, 148, 170, 238, 222, 167, 105, 251, 48, 9, 237, 20, 182, 137, 64, 6, 140, + 255, 217 }; + + private SortedMap<String, Channel> channels = new TreeMap<String, Channel>(); + + private Channel[] channelArray; + + private int width; + + private int height; + + private int channelHeight; + + private int x; + + private boolean resizing; + + private Color black; + + private Color white; + + public OScope(Composite parent, int style) + { + super(parent, style | SWT.DOUBLE_BUFFERED); + black = getDisplay().getSystemColor(SWT.COLOR_BLACK); + white = getDisplay().getSystemColor(SWT.COLOR_WHITE); + + setBackgroundImage(createBackgroundImage()); + addPaintListener(this); + addControlListener(this); + + Channel channel = new Channel(INITIAL); + channels.put(INITIAL, channel); + channelArray = new Channel[] { channel }; + + run(); + } + + public int getTimerExecMillis() + { + return 25; + } + + @Override + public void dispose() + { + super.dispose(); + } + + public Channel getChannel(String name) + { + synchronized (channels) + { + Channel channel = channels.get(name); + if (channel == null) + { + boolean resize = false; + + channel = channels.remove(INITIAL); + if (channel == null) + { + channel = new Channel(name); + resize = true; + } + else + { + channel.setName(name); + } + + channels.put(name, channel); + channelArray = channels.values().toArray(new Channel[channels.size()]); + + if (resize) + { + getDisplay().syncExec(new Runnable() + { + public void run() + { + controlResized(null); + } + }); + } + } + + return channel; + } + } + + public void controlMoved(ControlEvent e) + { + // Do nothing + } + + public void controlResized(ControlEvent e) + { + try + { + resizing = true; + Point size = getSize(); + width = size.x; + height = size.y; + + int count = channelArray.length; + if (count == 0) + { + return; + } + + x = Math.min(x, width); + + int oldChannelHeight = channelHeight; + if (oldChannelHeight == 0) + { + oldChannelHeight = 1; + } + + channelHeight = height / (2 * count); + + int y = channelHeight; + for (Channel channel : channelArray) + { + channel.resize(y, oldChannelHeight); + y += channelHeight + channelHeight; + } + } + finally + { + resizing = false; + } + } + + public void paintControl(PaintEvent e) + { + if (!resizing) + { + GC gc = e.gc; + gc.setAdvanced(true); + gc.setAntialias(SWT.ON); + + for (Channel channel : channelArray) + { + channel.paint(e.gc); + } + } + } + + public void run() + { + if (isDisposed()) + { + return; + } + + redraw(); + + if (++x >= width) + { + x = 0; + } + + getDisplay().timerExec(getTimerExecMillis(), this); + } + + protected Image createBackgroundImage() + { + byte[] bytes = new byte[BACKGROUND.length]; + for (int i = 0; i < BACKGROUND.length; i++) + { + bytes[i] = (byte)BACKGROUND[i]; + } + + return new Image(getDisplay(), new ByteArrayInputStream(bytes)); + } + + /** + * @author Eike Stepper + */ + public class Channel + { + private String name; + + private int[] values; + + private int[] head; + + private int headIndex; + + private boolean headNegate; + + private int y; + + public Channel(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setHead(int[] head) + { + headIndex = 0; + headNegate = false; + this.head = head; + } + + public void peak() + { + setHead(PEAK); + } + + @Override + public String toString() + { + return "Channel[" + name + "]"; + } + + public void resize(int y, int oldChannelHeight) + { + int max = 0; + int[] newValues = new int[2 * width]; + if (values != null) + { + System.arraycopy(values, 0, newValues, 0, Math.min(values.length, newValues.length)); + max = Math.min(values.length / 2, width); + } + + int x = 0; + for (; x < max; x++) + { + int i = 2 * x; + newValues[i] = x; + newValues[i + 1] = (newValues[i + 1] - this.y) * channelHeight / oldChannelHeight + y; + } + + for (; x < width; x++) + { + int i = 2 * x; + newValues[i] = x; + newValues[i + 1] = y; + } + + values = newValues; + this.y = y; + } + + public void paint(GC gc) + { + int i = 2 * x + 1; + if (values == null || i >= values.length) + { + return; + } + + int value = getNextValue() + RANDOM.nextInt(4) - 2; + int fx = y + value * channelHeight / 100; + values[i] = fx; + + gc.setForeground(white); + gc.setLineWidth(1); + gc.drawPolyline(values); + + gc.setForeground(black); + gc.setLineWidth(2); + gc.drawRectangle(x, fx, 2, 2); + } + + void setName(String name) + { + this.name = name; + } + + private int getNextValue() + { + if (head == null) + { + return 0; + } + + int value; + if (headNegate) + { + value = -head[headIndex]; + if (++headIndex >= head.length) + { + setHead(null); + headNegate = !headNegate; + } + } + else + { + value = head[headIndex]; + } + + headNegate = !headNegate; + return value; + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Perspective.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryPerspective.java index 9d20bb7318..837b1953ab 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/Perspective.java +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryPerspective.java @@ -16,14 +16,12 @@ import org.eclipse.ui.IPerspectiveFactory; /** * @author Eike Stepper */ -public class Perspective implements IPerspectiveFactory +public class FailoverRepositoryPerspective implements IPerspectiveFactory { public void createInitialLayout(IPageLayout layout) { - layout.setFixed(true); layout.setEditorAreaVisible(false); - - layout.addView("org.myzilla.app.details", IPageLayout.LEFT, 0.5f, IPageLayout.ID_EDITOR_AREA); - layout.addView("org.myzilla.app.navigator", IPageLayout.LEFT, 0.42f, "org.myzilla.app.details"); + layout.setFixed(true); + layout.addView(FailoverRepositoryView.ID, IPageLayout.LEFT, 0.5f, IPageLayout.ID_EDITOR_AREA); } } diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java new file mode 100644 index 0000000000..653047b32d --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/FailoverRepositoryView.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +/** + * @author Eike Stepper + */ +public class FailoverRepositoryView extends NormalRepositoryView +{ + public static final String ID = "org.eclipse.emf.cdo.examples.client.offline.FailoverRepositoryView"; //$NON-NLS-1$ + + public FailoverRepositoryView() + { + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryPerspective.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryPerspective.java new file mode 100644 index 0000000000..1b6da7895a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryPerspective.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * @author Eike Stepper + */ +public class NormalRepositoryPerspective implements IPerspectiveFactory +{ + public void createInitialLayout(IPageLayout layout) + { + layout.setEditorAreaVisible(false); + layout.setFixed(true); + layout.addView(NormalRepositoryView.ID, IPageLayout.LEFT, 0.5f, IPageLayout.ID_EDITOR_AREA); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryView.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryView.java new file mode 100644 index 0000000000..ceca37590c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/NormalRepositoryView.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline; + +import org.eclipse.emf.cdo.server.IRepository; + +import org.eclipse.net4j.util.ui.views.ItemProvider; + +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.widgets.Composite; + +/** + * @author Eike Stepper + */ +public class NormalRepositoryView extends AbstractView<IRepository> +{ + public static final String ID = "org.eclipse.emf.cdo.examples.client.offline.NormalRepositoryView"; //$NON-NLS-1$ + + private TreeViewer treeViewer; + + private ScrolledComposite details; + + public NormalRepositoryView() + { + super(IRepository.class); + } + + @Override + protected void createPane(Composite parent, IRepository repository, ItemProvider<IRepository> itemProvider) + { + SashForm sash = new SashForm(parent, SWT.SMOOTH); + + treeViewer = new TreeViewer(sash, SWT.BORDER); + treeViewer.setLabelProvider(itemProvider); + treeViewer.setContentProvider(itemProvider); + treeViewer.setInput(Application.NODE.getObject(IRepository.class)); + + details = new ScrolledComposite(sash, SWT.V_SCROLL); + details.setExpandHorizontal(true); + details.setExpandVertical(true); + + sash.setWeights(new int[] { 1, 1 }); + } + + @Override + public void setFocus() + { + treeViewer.getTree().setFocus(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/IElement.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/IElement.java new file mode 100644 index 0000000000..e07e7051e7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/IElement.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline.nodes; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +import java.util.Properties; + +/** + * @author Eike Stepper + */ +public interface IElement +{ + public Properties getSettings(); + + public void showSettings(); + + public Image getImage(); + + public Composite getDetailsControl(); + +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/Node.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/Node.java new file mode 100644 index 0000000000..a3e42743d7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/Node.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline.nodes; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * @author Eike Stepper + */ +public final class Node implements IElement, Comparable<Node> +{ + private final NodeType type; + + private final Properties settings; + + private final Map<Class<?>, Object> objects = new HashMap<Class<?>, Object>(); + + public Node(NodeType type, Properties settings) + { + this.type = type; + this.settings = settings; + } + + public Node(NodeType type) + { + this(type, copySettings(type)); + } + + public NodeManager getManager() + { + return type.getManager(); + } + + public File getFolder() + { + return new File(type.getManager().getRoot(), getName()); + } + + public NodeType getType() + { + return type; + } + + public String getName() + { + return settings.getProperty(NodeType.NAME_PROPERTY); + } + + public Properties getSettings() + { + return settings; + } + + public String getSetting(String key) + { + return settings.getProperty(key); + } + + public void showSettings() + { + type.showSettings(this); + } + + public Image getImage() + { + return type.getInstanceImage(); + } + + public Composite getDetailsControl() + { + return type.getDetailsControl(this); + } + + public Map<Class<?>, Object> getObjects() + { + return objects; + } + + @SuppressWarnings("unchecked") + public <T> T getObject(Class<T> type) + { + return (T)objects.get(type); + } + + public void start() + { + type.start(this); + } + + public void stop() + { + type.stop(this); + } + + @Override + public String toString() + { + return getName(); + } + + public int compareTo(Node o) + { + return getName().compareTo(o.getName()); + } + + private static Properties copySettings(NodeType type) + { + Properties settings = new Properties(); + settings.putAll(type.getSettings()); + return settings; + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManager.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManager.java new file mode 100644 index 0000000000..aa1422768a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManager.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline.nodes; + +import org.eclipse.net4j.util.container.Container; +import org.eclipse.net4j.util.io.IORuntimeException; +import org.eclipse.net4j.util.io.IOUtil; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * @author Eike Stepper + */ +public class NodeManager extends Container<Object> +{ + private static final String NODE_PROPERTIES = "node.properties"; + + private final Map<String, Node> nodes = new HashMap<String, Node>(); + + private final NodeType.Client client = new NodeType.Client(this); + + private final NodeType.NormalRepository normalRepository = new NodeType.NormalRepository(this); + + private final NodeType.FailoverRepository failoverRepository = new NodeType.FailoverRepository(this); + + private final NodeType.FailoverMonitor failoverMonitor = new NodeType.FailoverMonitor(this); + + private final NodeType[] elements = { client, normalRepository, failoverRepository, failoverMonitor }; + + private final File root; + + public NodeManager(File root) + { + this.root = root; + + if (!root.exists()) + { + root.mkdirs(); + } + + if (!root.isDirectory()) + { + throw new IllegalStateException("Problem with root folder: " + root); + } + + List<Node> result = new ArrayList<Node>(); + for (File folder : root.listFiles()) + { + if (folder.isDirectory()) + { + Node node = loadNode(folder); + if (node != null) + { + result.add(node); + } + } + } + + activate(); + } + + private Node loadNode(File folder) + { + Properties properties = loadProperties(folder); + if (properties != null) + { + String typeName = properties.getProperty(NodeType.TYPE_PROPERTY); + for (NodeType nodeType : elements) + { + if (nodeType.getTypeName().equals(typeName)) + { + Node node = new Node(nodeType, properties); + return addNode(node); + } + } + } + + return null; + } + + private Properties loadProperties(File folder) + { + File file = new File(folder, NODE_PROPERTIES); + if (file.isFile()) + { + InputStream in = null; + + try + { + in = new FileInputStream(file); + + Properties properties = new Properties(); + properties.load(in); + return properties; + } + catch (IOException ex) + { + throw new IORuntimeException(ex); + } + finally + { + IOUtil.close(in); + } + } + + return null; + } + + public File getRoot() + { + return root; + } + + public Node getNode(String name) + { + return nodes.get(name); + } + + public Node[] getNodes() + { + Node[] array = nodes.values().toArray(new Node[nodes.size()]); + Arrays.sort(array); + return array; + } + + @Override + public boolean isEmpty() + { + return false; + } + + public NodeType[] getElements() + { + return elements; + } + + public Node createNode(NodeType nodeType) + { + Node node = new Node(nodeType); + OutputStream out = null; + + try + { + File folder = node.getFolder(); + folder.mkdirs(); + + File file = new File(folder, NODE_PROPERTIES); + out = new FileOutputStream(file); + node.getSettings().store(out, "Node Settings"); + } + catch (IOException ex) + { + throw new IORuntimeException(ex); + } + finally + { + IOUtil.close(out); + } + + return addNode(node); + } + + private Node addNode(Node node) + { + nodes.put(node.getName(), node); + node.getType().addElement(node); + return node; + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java new file mode 100644 index 0000000000..cb025c7102 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeManagerDialog.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline.nodes; + +import org.eclipse.emf.cdo.examples.client.offline.Application; + +import org.eclipse.net4j.util.ui.views.ContainerItemProvider; +import org.eclipse.net4j.util.ui.views.ItemProvider; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.wb.swt.ResourceManager; + +import java.util.Properties; + +/** + * @author Eike Stepper + */ +public class NodeManagerDialog extends TitleAreaDialog +{ + public static final int TYPE = 0; + + public static final int NODE = 1; + + private final NodeManager nodeManager; + + private IElement currentElement; + + private TreeViewer treeViewer; + + private Composite details; + + private StackLayout detailsStack; + + private boolean updatingDetails; + + public static final String TITLE = "CDO Offline Example"; + + public NodeManagerDialog(Shell parentShell, NodeManager nodeManager) + { + super(parentShell); + this.nodeManager = nodeManager; + setHelpAvailable(false); + setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.PRIMARY_MODAL); + } + + public NodeManager getNodeManager() + { + return nodeManager; + } + + public Node getCurrentNode() + { + if (currentElement instanceof Node) + { + return (Node)currentElement; + } + + return null; + } + + @Override + protected void configureShell(Shell newShell) + { + super.configureShell(newShell); + newShell.setText(TITLE); + } + + @Override + protected Control createDialogArea(Composite parent) + { + ItemProvider<NodeManager> itemProvider = new ContainerItemProvider<NodeManager>() + { + @Override + public Image getImage(Object obj) + { + return ((IElement)obj).getImage(); + } + }; + + setTitle("Node Manager"); + setTitleImage(ResourceManager.getPluginImage(Application.PLUGIN_ID, "icons/NodeManager.gif")); + setMessage("Select an existing node or create a new one."); + + Composite area = (Composite)super.createDialogArea(parent); + SashForm container = new SashForm(area, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayout(new GridLayout(1, false)); + + treeViewer = new TreeViewer(composite, SWT.BORDER); + treeViewer.setLabelProvider(itemProvider); + treeViewer.setContentProvider(itemProvider); + treeViewer.addSelectionChangedListener(new ISelectionChangedListener() + { + public void selectionChanged(SelectionChangedEvent event) + { + setCurrentElement(); + } + }); + + treeViewer.addDoubleClickListener(new IDoubleClickListener() + { + public void doubleClick(DoubleClickEvent event) + { + if (getCurrentNode() != null) + { + close(); + } + } + }); + + Tree tree = treeViewer.getTree(); + tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + details = new Composite(container, SWT.NONE); + detailsStack = new StackLayout(); + details.setLayout(detailsStack); + + for (NodeType nodeType : nodeManager.getElements()) + { + nodeType.createUI(this, TYPE); + nodeType.createUI(this, NODE); + } + + treeViewer.setInput(nodeManager); + treeViewer.expandAll(); + container.setWeights(new int[] { 1, 1 }); + return area; + } + + public Composite getDetails() + { + return details; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) + { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + @Override + protected Point getInitialSize() + { + return new Point(500, 500); + } + + private void setCurrentElement() + { + if (treeViewer != null) + { + IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection(); + currentElement = (IElement)selection.getFirstElement(); + } + + getButton(IDialogConstants.OK_ID).setEnabled(getCurrentNode() != null); + if (currentElement != null) + { + Control control = currentElement.getDetailsControl(); + detailsStack.topControl = control; + + try + { + updatingDetails = true; + currentElement.showSettings(); + } + finally + { + updatingDetails = false; + } + } + else + { + detailsStack.topControl = null; + } + + details.layout(); + } + + public void onModify(NodeType.Property property, String value) + { + Properties settings = currentElement.getSettings(); + String name = property.getName(); + settings.setProperty(name, value); + } + + public void onCreate(NodeType nodeType) + { + nodeManager.createNode(nodeType); + } + + public void onDelete(NodeType nodeType) + { + } + + public boolean isUpdatingDetails() + { + return updatingDetails; + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java new file mode 100644 index 0000000000..5c04b5acc3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/emf/cdo/examples/client/offline/nodes/NodeType.java @@ -0,0 +1,727 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.examples.client.offline.nodes; + +import org.eclipse.emf.cdo.common.revision.CDORevisionCache; +import org.eclipse.emf.cdo.common.revision.CDORevisionUtil; +import org.eclipse.emf.cdo.examples.client.offline.Application; +import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; +import org.eclipse.emf.cdo.net4j.CDONet4jUtil; +import org.eclipse.emf.cdo.server.CDOServerUtil; +import org.eclipse.emf.cdo.server.IRepository; +import org.eclipse.emf.cdo.server.IRepositorySynchronizer; +import org.eclipse.emf.cdo.server.IStore; +import org.eclipse.emf.cdo.server.ISynchronizableRepository; +import org.eclipse.emf.cdo.server.db.CDODBUtil; +import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; +import org.eclipse.emf.cdo.server.net4j.FailoverAgent; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory; + +import org.eclipse.net4j.Net4jUtil; +import org.eclipse.net4j.acceptor.IAcceptor; +import org.eclipse.net4j.connector.IConnector; +import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.IDBConnectionProvider; +import org.eclipse.net4j.db.h2.H2Adapter; +import org.eclipse.net4j.util.container.IPluginContainer; +import org.eclipse.net4j.util.container.SetContainer; +import org.eclipse.net4j.util.lifecycle.LifecycleUtil; + +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.wb.swt.ResourceManager; + +import org.h2.jdbcx.JdbcDataSource; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * @author Eike Stepper + */ +public abstract class NodeType extends SetContainer<Node> implements IElement +{ + public static final String TYPE_PROPERTY = "Type"; + + public static final String NAME_PROPERTY = "Name"; + + public static final String PORT_PROPERTY = "Port"; + + public static final String SERVER_PROPERTY = "Server"; + + public static final String MONITOR_PROPERTY = "Monitor"; + + private static final String REPOSITORY_NAME = "repository"; + + private final NodeManager manager; + + private final List<Property> properties = new ArrayList<Property>(); + + private final Properties settings = new Properties(); + + private final Composite[] detailsControls = { null, null }; + + public NodeType(NodeManager manager) + { + super(Node.class); + this.manager = manager; + addProperty(new Property.Entry(this, NAME_PROPERTY)); + settings.setProperty(TYPE_PROPERTY, getTypeName()); + activate(); + } + + public NodeManager getManager() + { + return manager; + } + + public List<Property> getProperties() + { + return properties; + } + + public Properties getSettings() + { + return settings; + } + + public void showSettings() + { + showSettings(null); + } + + public void showSettings(Node node) + { + Composite composite = getDetailsControl(node); + Control[] children = composite.getChildren(); + + Properties settings = node == null ? this.settings : node.getSettings(); + for (Property property : properties) + { + String name = property.getName(); + Control control = getControl(children, name); + if (control != null) + { + String value = settings.getProperty(name, ""); + property.showSetting(control, value); + } + } + } + + public void configureWindow(IWorkbenchWindowConfigurer configurer) + { + configurer.setInitialSize(new Point(1000, 700)); + configurer.setTitle(Application.NODE.getName()); + configurer.setShowCoolBar(false); + configurer.setShowMenuBar(false); + configurer.setShowStatusLine(false); + } + + private Control getControl(Control[] children, String name) + { + for (Control control : children) + { + if (name.equals(control.getData("name"))) + { + return control; + } + } + + return null; + } + + public Image getImage() + { + return ResourceManager.getPluginImage(Application.PLUGIN_ID, "icons/Folder.gif"); + } + + public Image getInstanceImage() + { + return ResourceManager.getPluginImage(Application.PLUGIN_ID, "icons/" + getTypeName() + ".gif"); + } + + public String getTypeName() + { + String name = getClass().getSimpleName(); + int lastDot = name.lastIndexOf('.'); + if (lastDot != -1) + { + name = name.substring(lastDot + 1); + } + + return name; + } + + public Composite getDetailsControl() + { + return getDetailsControl(null); + } + + public Composite getDetailsControl(Node node) + { + if (node == null) + { + return detailsControls[0]; + } + + return detailsControls[1]; + } + + public void start(Node node) + { + IRepository repository = createRepository(node); + node.getObjects().put(IRepository.class, repository); + + IAcceptor acceptor = createAcceptor(node); + node.getObjects().put(IAcceptor.class, acceptor); + } + + public void stop(Node node) + { + IAcceptor acceptor = node.getObject(IAcceptor.class); + LifecycleUtil.deactivate(acceptor); + + IRepository repository = node.getObject(IRepository.class); + LifecycleUtil.deactivate(repository); + } + + public Button createUI(final NodeManagerDialog dialog, int kind) + { + Composite composite = new Composite(dialog.getDetails(), SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + + for (Property property : properties) + { + property.createField(dialog, composite); + } + + new Label(composite, SWT.NONE); + + Button button = new Button(composite, SWT.PUSH); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + if (kind == NodeManagerDialog.NODE) + { + button.setText("Delete"); + button.addSelectionListener(new SelectionAdapter() + { + @Override + public void widgetSelected(SelectionEvent e) + { + dialog.onDelete(NodeType.this); + } + }); + + composite.setEnabled(false); + detailsControls[1] = composite; + } + else + { + button.setText("Create"); + button.addSelectionListener(new SelectionAdapter() + { + @Override + public void widgetSelected(SelectionEvent e) + { + dialog.onCreate(NodeType.this); + } + }); + + detailsControls[0] = composite; + } + + return button; + } + + protected void addProperty(Property property) + { + properties.add(property); + } + + @Override + protected Node[] sortElements(Node[] array) + { + Arrays.sort(array); + return array; + } + + protected IRepository createRepository(Node node) + { + JdbcDataSource dataSource = new JdbcDataSource(); + dataSource.setURL("jdbc:h2:" + node.getFolder() + "/db/repository"); + + IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true); + IDBAdapter dbAdapter = new H2Adapter(); + IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource); + IStore store = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider); + + Map<String, String> props = new HashMap<String, String>(); + props.put(IRepository.Props.OVERRIDE_UUID, REPOSITORY_NAME); + props.put(IRepository.Props.SUPPORTING_AUDITS, "true"); + props.put(IRepository.Props.SUPPORTING_BRANCHES, "true"); + + IRepository repository = createRepository(node, store, props); + CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository); + return repository; + } + + protected IRepository createRepository(Node node, IStore store, Map<String, String> props) + { + return CDOServerUtil.createRepository(REPOSITORY_NAME, store, props); + } + + protected IAcceptor createAcceptor(Node node) + { + String description = "0.0.0.0:" + node.getSetting(PORT_PROPERTY); + return (IAcceptor)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.acceptors", "tcp", description); + } + + /** + * @author Eike Stepper + */ + public static abstract class Property + { + private final NodeType container; + + private final String name; + + public Property(NodeType container, String name) + { + this.container = container; + this.name = name; + } + + public NodeType getContainer() + { + return container; + } + + public String getName() + { + return name; + } + + public abstract void createField(NodeManagerDialog dialog, Composite parent); + + public abstract void showSetting(Control control, String value); + + /** + * @author Eike Stepper + */ + public static abstract class Labelled extends Property + { + public Labelled(NodeType container, String name) + { + super(container, name); + } + + @Override + public void createField(NodeManagerDialog dialog, Composite parent) + { + String name = getName(); + Label label = new Label(parent, SWT.NONE); + + label.setText(name + ":"); + label.setLayoutData(new GridData(GridData.END)); + + Control control = createControl(dialog, parent); + control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + control.setData("name", name); + } + + protected abstract Control createControl(NodeManagerDialog dialog, Composite parent); + } + + /** + * @author Eike Stepper + */ + public static class Entry extends Labelled + { + public Entry(NodeType container, String name) + { + super(container, name); + } + + @Override + protected Control createControl(final NodeManagerDialog dialog, Composite parent) + { + final Text text = new Text(parent, SWT.BORDER); + text.addModifyListener(new ModifyListener() + { + public void modifyText(ModifyEvent e) + { + if (!dialog.isUpdatingDetails()) + { + dialog.onModify(Entry.this, text.getText()); + } + } + }); + + return text; + } + + @Override + public void showSetting(Control control, String value) + { + ((Text)control).setText(value); + } + } + + /** + * @author Eike Stepper + */ + public static class Selection extends Labelled + { + private final Class<? extends NodeType> type; + + public Selection(NodeType container, String name, Class<? extends NodeType> type) + { + super(container, name); + this.type = type; + } + + public Class<? extends NodeType> getType() + { + return type; + } + + @Override + protected Control createControl(final NodeManagerDialog dialog, Composite parent) + { + final ComboViewer comboViewer = new ComboViewer(parent, SWT.NONE); + comboViewer.setLabelProvider(new LabelProvider()); + comboViewer.setContentProvider(new IStructuredContentProvider() + { + public Object[] getElements(Object inputElement) + { + List<Node> result = new ArrayList<Node>(); + Node[] nodes = getContainer().getManager().getNodes(); + for (Node node : nodes) + { + if (type.isAssignableFrom(node.getType().getClass())) + { + result.add(node); + } + } + + Collections.sort(result); + return result.toArray(new Node[result.size()]); + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) + { + } + + public void dispose() + { + } + }); + + comboViewer.addSelectionChangedListener(new ISelectionChangedListener() + { + public void selectionChanged(SelectionChangedEvent event) + { + if (!dialog.isUpdatingDetails()) + { + IStructuredSelection selection = (IStructuredSelection)comboViewer.getSelection(); + Node node = (Node)selection.getFirstElement(); + if (node != null) + { + dialog.onModify(Selection.this, node.getName()); + } + } + } + }); + + comboViewer.setInput(new Object()); + + Combo combo = comboViewer.getCombo(); + combo.setData("viewer", comboViewer); + return combo; + } + + @Override + public void showSetting(Control control, String value) + { + ComboViewer comboViewer = (ComboViewer)control.getData("viewer"); + comboViewer.refresh(true); + + Node node = getContainer().getManager().getNode(value); + if (node != null) + { + comboViewer.setSelection(new StructuredSelection(node)); + } + else + { + comboViewer.setSelection(StructuredSelection.EMPTY); + } + } + } + } + + /** + * @author Eike Stepper + */ + public static class Client extends NodeType + { + public Client(NodeManager manager) + { + super(manager); + addProperty(new Property.Selection(this, SERVER_PROPERTY, Server.class)); + } + + @Override + public void start(Node node) + { + super.start(node); + + CDOSession session = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions", "cdo", + "jvm://example"); + node.getObjects().put(CDOSession.class, session); + } + + @Override + public void stop(Node node) + { + CDOSession session = node.getObject(CDOSession.class); + LifecycleUtil.deactivate(session); + + super.stop(node); + } + + @Override + protected IRepository createRepository(Node node, IStore store, Map<String, String> props) + { + String serverName = node.getSetting(SERVER_PROPERTY); + Node serverNode = getManager().getNode(serverName); + if (serverNode == null) + { + throw new IllegalStateException("Server not found: " + serverName); + } + + final String serverAddress = "localhost:" + serverNode.getSetting(PORT_PROPERTY); + + CDOSessionConfigurationFactory factory = new CDOSessionConfigurationFactory() + { + public CDONet4jSessionConfiguration createSessionConfiguration() + { + IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", serverAddress); + + CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); + configuration.setConnector(connector); + configuration.setRepositoryName(REPOSITORY_NAME); + configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP)); + + return configuration; + } + }; + + IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory); + synchronizer.setRetryInterval(2); + synchronizer.setMaxRecommits(10); + synchronizer.setRecommitInterval(2); + + return CDOServerUtil.createOfflineClone(REPOSITORY_NAME, store, props, synchronizer); + } + + @Override + protected IAcceptor createAcceptor(Node node) + { + return (IAcceptor)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.acceptors", "jvm", "example"); + } + + @Override + public String toString() + { + return "Clients"; + } + } + + /** + * @author Eike Stepper + */ + public static abstract class Server extends NodeType + { + public Server(NodeManager manager) + { + super(manager); + addProperty(new Property.Entry(this, PORT_PROPERTY)); + } + } + + /** + * @author Eike Stepper + */ + public static abstract class Repository extends Server + { + public Repository(NodeManager manager) + { + super(manager); + } + + @Override + public String toString() + { + return "Normal Repositories"; + } + } + + /** + * @author Eike Stepper + */ + public static class NormalRepository extends Repository + { + public NormalRepository(NodeManager manager) + { + super(manager); + } + + @Override + public String toString() + { + return "Normal Repositories"; + } + } + + /** + * @author Eike Stepper + */ + public static class FailoverRepository extends Repository + { + public FailoverRepository(NodeManager manager) + { + super(manager); + addProperty(new Property.Selection(this, MONITOR_PROPERTY, FailoverMonitor.class)); + } + + @Override + protected IRepository createRepository(Node node, IStore store, Map<String, String> props) + { + String monitorName = node.getSetting(MONITOR_PROPERTY); + Node monitorNode = getManager().getNode(monitorName); + if (monitorNode == null) + { + throw new IllegalStateException("Monitor not found: " + monitorName); + } + + final String monitorAddress = "localhost:" + monitorNode.getSetting(PORT_PROPERTY); + + ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(REPOSITORY_NAME, store, props); + + FailoverAgent agent = new FailoverAgent() + { + @Override + protected CDONet4jSessionConfiguration createSessionConfiguration(String connectorDescription, + String repositoryName) + { + IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", connectorDescription); + + CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); + configuration.setConnector(connector); + configuration.setRepositoryName(repositoryName); + configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP)); + return configuration; + } + }; + + IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", monitorAddress); + + agent.setMonitorConnector(connector); + agent.setConnectorDescription("localhost:" + node.getSetting(PORT_PROPERTY)); + agent.setRepository(repository); + agent.setGroup(monitorNode.getName()); + agent.setRate(1500L); + agent.setTimeout(3000L); + agent.activate(); + + return repository; + } + + @Override + public String toString() + { + return "Failover Repositories"; + } + } + + /** + * @author Eike Stepper + */ + public static class FailoverMonitor extends Server + { + public FailoverMonitor(NodeManager manager) + { + super(manager); + } + + @Override + public void start(Node node) + { + super.start(node); + + org.eclipse.emf.cdo.server.net4j.FailoverMonitor monitor = (org.eclipse.emf.cdo.server.net4j.FailoverMonitor)IPluginContainer.INSTANCE + .getElement(org.eclipse.emf.cdo.server.net4j.FailoverMonitor.PRODUCT_GROUP, + org.eclipse.emf.cdo.server.net4j.FailoverMonitor.Factory.TYPE, node.getName()); + node.getObjects().put(org.eclipse.emf.cdo.server.net4j.FailoverMonitor.class, monitor); + } + + @Override + public void stop(Node node) + { + org.eclipse.emf.cdo.server.net4j.FailoverMonitor monitor = node + .getObject(org.eclipse.emf.cdo.server.net4j.FailoverMonitor.class); + LifecycleUtil.deactivate(monitor); + + super.stop(node); + } + + @Override + protected IRepository createRepository(Node node) + { + return null; + } + + @Override + public String toString() + { + return "Failover Monitors"; + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/ResourceManager.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/ResourceManager.java new file mode 100644 index 0000000000..42b9dc18f4 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/ResourceManager.java @@ -0,0 +1,511 @@ +/******************************************************************************* + * Copyright (c) 2011 Google, Inc. + * 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: + * Google, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.wb.swt; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.osgi.framework.Bundle; + +import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, + * etc. + * + * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the + * operating system resources managed by cached objects when those objects and OS resources are no longer + * needed (e.g. on application shutdown) + * + * This class may be freely distributed as part of any application or plugin. + * <p> + * + * @author scheglov_ke + * @author Dan Rubel + */ +public class ResourceManager extends SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>(); + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified + * class. + * + * @param clazz + * the {@link Class} relative to which to find the image descriptor. + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) + { + return ImageDescriptor.createFromFile(clazz, path); + } + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path. + * + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(String path) + { + try + { + return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); + } + catch (MalformedURLException e) + { + return null; + } + } + + /** + * Returns an {@link Image} based on the specified {@link ImageDescriptor}. + * + * @param descriptor + * the {@link ImageDescriptor} for the {@link Image}. + * @return the {@link Image} based on the specified {@link ImageDescriptor}. + */ + public static Image getImage(ImageDescriptor descriptor) + { + if (descriptor == null) + { + return null; + } + Image image = m_descriptorImageMap.get(descriptor); + if (image == null) + { + image = descriptor.createImage(); + m_descriptorImageMap.put(descriptor, image); + } + return image; + } + + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @return {@link Image} The resulting decorated image. + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @param corner + * the corner to place decorator image. + * @return the resulting decorated {@link Image}. + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap<Image, Image>(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) + { + final Rectangle bib = baseImage.getBounds(); + final Rectangle dib = decorator.getBounds(); + final Point baseImageSize = new Point(bib.width, bib.height); + CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() + { + @Override + protected void drawCompositeImage(int width, int height) + { + drawImage(baseImage.getImageData(), 0, 0); + if (corner == TOP_LEFT) + { + drawImage(decorator.getImageData(), 0, 0); + } + else if (corner == TOP_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + drawImage(decorator.getImageData(), 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height); + } + } + + @Override + protected Point getSize() + { + return baseImageSize; + } + }; + // + result = compositImageDesc.createImage(); + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached images. + */ + public static void disposeImages() + { + SWTResourceManager.disposeImages(); + // dispose ImageDescriptor images + { + for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) + { + I.next().dispose(); + } + m_descriptorImageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) + { + for (Image image : decoratedMap.values()) + { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + // dispose plugin images + { + for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) + { + I.next().dispose(); + } + m_URLImageMap.clear(); + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Plugin images support + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps URL to images. + */ + private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>(); + + /** + * Provider for plugin resources, used by WindowBuilder at design time. + */ + public interface PluginResourceProvider + { + URL getEntry(String symbolicName, String path); + } + + /** + * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time. + */ + private static PluginResourceProvider m_designTimePluginResourceProvider = null; + + /** + * Returns an {@link Image} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image + * @param name + * the path to the image within the plugin + * @return the {@link Image} stored in the file at the specified path + * + * @deprecated Use {@link #getPluginImage(String, String)} instead. + */ + @Deprecated + public static Image getPluginImage(Object plugin, String name) + { + try + { + URL url = getPluginImageURL(plugin, name); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link Image} stored in the file at the specified path. + */ + public static Image getPluginImage(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on given {@link URL}. + */ + private static Image getPluginImageFromUrl(URL url) + { + try + { + try + { + String key = url.toExternalForm(); + Image image = m_URLImageMap.get(key); + if (image == null) + { + InputStream stream = url.openStream(); + try + { + image = getImage(stream); + m_URLImageMap.put(key, image); + } + finally + { + stream.close(); + } + } + return image; + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image. + * @param name + * the path to th eimage within the plugin. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + * + * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. + */ + @Deprecated + public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) + { + try + { + try + { + URL url = getPluginImageURL(plugin, name); + return ImageDescriptor.createFromURL(url); + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + */ + public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return ImageDescriptor.createFromURL(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link URL} based on a {@link Bundle} and resource entry path. + */ + private static URL getPluginImageURL(String symbolicName, String path) + { + // try runtime plugins + { + Bundle bundle = Platform.getBundle(symbolicName); + if (bundle != null) + { + return bundle.getEntry(path); + } + } + // try design time provider + if (m_designTimePluginResourceProvider != null) + { + return m_designTimePluginResourceProvider.getEntry(symbolicName, path); + } + // no such resource + return null; + } + + /** + * Returns an {@link URL} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the file path. + * @param name + * the file path. + * @return the {@link URL} representing the file at the specified path. + * @throws Exception + */ + private static URL getPluginImageURL(Object plugin, String name) throws Exception + { + // try to work with 'plugin' as with OSGI BundleContext + try + { + Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ + Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ + if (BundleContextClass.isAssignableFrom(plugin.getClass())) + { + Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ + Object bundle = getBundleMethod.invoke(plugin, new Object[0]); + // + Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ + Method findMethod = PlatformClass.getMethod("find", new Class[] { BundleClass, IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(null, new Object[] { bundle, path }); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + // else work with 'plugin' as with usual Eclipse plugin + { + Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ + if (PluginClass.isAssignableFrom(plugin.getClass())) + { + // + Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Method findMethod = PluginClass.getMethod("find", new Class[] { IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(plugin, new Object[] { path }); + } + } + return null; + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeFonts(); + disposeImages(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java new file mode 100644 index 0000000000..3bcc1029a6 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.client.offline/src/org/eclipse/wb/swt/SWTResourceManager.java @@ -0,0 +1,538 @@ +/******************************************************************************* + * Copyright (c) 2011 Google, Inc. + * 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: + * Google, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.wb.swt; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. + * <p> + * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the + * operating system resources managed by cached objects when those objects and OS resources are no longer + * needed (e.g. on application shutdown) + * <p> + * This class may be freely distributed as part of any application or plugin. + * <p> + * @author scheglov_ke + * @author Dan Rubel + */ +public class SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Color + // + // ////////////////////////////////////////////////////////////////////////// + private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); + + /** + * Returns the system {@link Color} matching the specific ID. + * + * @param systemColorID + * the ID value for the color + * @return the system {@link Color} matching the specific ID + */ + public static Color getColor(int systemColorID) + { + Display display = Display.getCurrent(); + return display.getSystemColor(systemColorID); + } + + /** + * Returns a {@link Color} given its red, green and blue component values. + * + * @param r + * the red component of the color + * @param g + * the green component of the color + * @param b + * the blue component of the color + * @return the {@link Color} matching the given red, green and blue component values + */ + public static Color getColor(int r, int g, int b) + { + return getColor(new RGB(r, g, b)); + } + + /** + * Returns a {@link Color} given its RGB value. + * + * @param rgb + * the {@link RGB} value of the color + * @return the {@link Color} matching the RGB value + */ + public static Color getColor(RGB rgb) + { + Color color = m_colorMap.get(rgb); + if (color == null) + { + Display display = Display.getCurrent(); + color = new Color(display, rgb); + m_colorMap.put(rgb, color); + } + return color; + } + + /** + * Dispose of all the cached {@link Color}'s. + */ + public static void disposeColors() + { + for (Color color : m_colorMap.values()) + { + color.dispose(); + } + m_colorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps image paths to images. + */ + private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); + + /** + * Returns an {@link Image} encoded by the specified {@link InputStream}. + * + * @param stream + * the {@link InputStream} encoding the image data + * @return the {@link Image} encoded by the specified input stream + */ + protected static Image getImage(InputStream stream) throws IOException + { + try + { + Display display = Display.getCurrent(); + ImageData data = new ImageData(stream); + if (data.transparentPixel > 0) + { + return new Image(display, data, data.getTransparencyMask()); + } + return new Image(display, data); + } + finally + { + stream.close(); + } + } + + /** + * Returns an {@link Image} stored in the file at the specified path. + * + * @param path + * the path to the image file + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(String path) + { + Image image = m_imageMap.get(path); + if (image == null) + { + try + { + image = getImage(new FileInputStream(path)); + m_imageMap.put(path, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(path, image); + } + } + return image; + } + + /** + * Returns an {@link Image} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image + * @param path + * the path to the image file, if starts with <code>'/'</code> + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(Class<?> clazz, String path) + { + String key = clazz.getName() + '|' + path; + Image image = m_imageMap.get(key); + if (image == null) + { + try + { + image = getImage(clazz.getResourceAsStream(path)); + m_imageMap.put(key, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(key, image); + } + } + return image; + } + + private static final int MISSING_IMAGE_SIZE = 10; + + /** + * @return the small {@link Image} that can be used as placeholder for missing image. + */ + private static Image getMissingImage() + { + Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + // + GC gc = new GC(image); + gc.setBackground(getColor(SWT.COLOR_RED)); + gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + gc.dispose(); + // + return image; + } + + /** + * Style constant for placing decorator image in top left corner of base image. + */ + public static final int TOP_LEFT = 1; + + /** + * Style constant for placing decorator image in top right corner of base image. + */ + public static final int TOP_RIGHT = 2; + + /** + * Style constant for placing decorator image in bottom left corner of base image. + */ + public static final int BOTTOM_LEFT = 3; + + /** + * Style constant for placing decorator image in bottom right corner of base image. + */ + public static final int BOTTOM_RIGHT = 4; + + /** + * Internal value. + */ + protected static final int LAST_CORNER_KEY = 5; + + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @return {@link Image} The resulting decorated image + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @param corner + * the corner to place decorator image + * @return the resulting decorated {@link Image} + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap<Image, Image>(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) + { + Rectangle bib = baseImage.getBounds(); + Rectangle dib = decorator.getBounds(); + // + result = new Image(Display.getCurrent(), bib.width, bib.height); + // + GC gc = new GC(result); + gc.drawImage(baseImage, 0, 0); + if (corner == TOP_LEFT) + { + gc.drawImage(decorator, 0, 0); + } + else if (corner == TOP_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + gc.drawImage(decorator, 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); + } + gc.dispose(); + // + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached {@link Image}'s. + */ + public static void disposeImages() + { + // dispose loaded images + { + for (Image image : m_imageMap.values()) + { + image.dispose(); + } + m_imageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) + { + for (Image image : decoratedMap.values()) + { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Font + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps font names to fonts. + */ + private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); + + /** + * Maps fonts to their bold versions. + */ + private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); + + /** + * Returns a {@link Font} based on its name, height and style. + * + * @param name + * the name of the font + * @param height + * the height of the font + * @param style + * the style of the font + * @return {@link Font} The font matching the name, height and style + */ + public static Font getFont(String name, int height, int style) + { + return getFont(name, height, style, false, false); + } + + /** + * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline + * flags are also supported. + * + * @param name + * the name of the font + * @param size + * the size of the font + * @param style + * the style of the font + * @param strikeout + * the strikeout flag (warning: Windows only) + * @param underline + * the underline flag (warning: Windows only) + * @return {@link Font} The font matching the name, height, style, strikeout and underline + */ + public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) + { + String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; + Font font = m_fontMap.get(fontName); + if (font == null) + { + FontData fontData = new FontData(name, size, style); + if (strikeout || underline) + { + try + { + Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ + Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ + if (logFont != null && logFontClass != null) + { + if (strikeout) + { + logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + if (underline) + { + logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + } + } + catch (Throwable e) + { + System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + font = new Font(Display.getCurrent(), fontData); + m_fontMap.put(fontName, font); + } + return font; + } + + /** + * Returns a bold version of the given {@link Font}. + * + * @param baseFont + * the {@link Font} for which a bold version is desired + * @return the bold version of the given {@link Font} + */ + public static Font getBoldFont(Font baseFont) + { + Font font = m_fontToBoldFontMap.get(baseFont); + if (font == null) + { + FontData fontDatas[] = baseFont.getFontData(); + FontData data = fontDatas[0]; + font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); + m_fontToBoldFontMap.put(baseFont, font); + } + return font; + } + + /** + * Dispose all of the cached {@link Font}'s. + */ + public static void disposeFonts() + { + // clear fonts + for (Font font : m_fontMap.values()) + { + font.dispose(); + } + m_fontMap.clear(); + // clear bold fonts + for (Font font : m_fontToBoldFontMap.values()) + { + font.dispose(); + } + m_fontToBoldFontMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Cursor + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps IDs to cursors. + */ + private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); + + /** + * Returns the system cursor matching the specific ID. + * + * @param id + * int The ID value for the cursor + * @return Cursor The system cursor matching the specific ID + */ + public static Cursor getCursor(int id) + { + Integer key = Integer.valueOf(id); + Cursor cursor = m_idToCursorMap.get(key); + if (cursor == null) + { + cursor = new Cursor(Display.getDefault(), id); + m_idToCursorMap.put(key, cursor); + } + return cursor; + } + + /** + * Dispose all of the cached cursors. + */ + public static void disposeCursors() + { + for (Cursor cursor : m_idToCursorMap.values()) + { + cursor.dispose(); + } + m_idToCursorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeImages(); + disposeFonts(); + disposeCursors(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties index 2b1fa7cf13..4be2d1e112 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.properties @@ -24,6 +24,10 @@ ExampleClientWizard_name = CDO Client Example ExampleClientWizard_desc = Create plug-in projects with all the dependencies needed to start an Eclipse IDE with a CDO client in it. ExampleClientProject_desc = This project contains the needed dependency declarations and an Eclipse application launch config. +ExampleOfflineWizard_name = CDO Offline Example +ExampleOfflineWizard_desc = Create plug-in projects with all the dependencies needed to start an RCP application with fail-over and offline support. +ExampleOfflineProject_desc = This project contains the needed dependency declarations and an Eclipse application launch config. + ExampleModelWizard_name = CDO Model Example ExampleModelWizard_desc = Create plug-in projects for an example CDO model and the related edit support. ExampleModelProject_desc = This project contains the Company model and the implementation generated from it. diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml index 2cd130bf84..21c0bba83e 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.examples.installer/plugin.xml @@ -54,6 +54,16 @@ category="org.eclipse.ui.Examples/org.eclipse.emf.cdo.examples" class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" icon="icons/full/ctool16/NewEMFExample.gif" + id="org.eclipse.emf.cdo.examples.ExampleOfflineWizard" + name="%ExampleOfflineWizard_name" + project="true"> + <description>%ExampleOfflineWizard_desc</description> + </wizard> + <wizard + canFinishEarly="true" + category="org.eclipse.ui.Examples/org.eclipse.emf.cdo.examples" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + icon="icons/full/ctool16/NewEMFExample.gif" id="org.eclipse.emf.cdo.examples.ExampleModelWizard" name="%ExampleModelWizard_name" project="true"> @@ -111,6 +121,15 @@ description="%ExampleEditProject_desc"/> </example> <example + id="org.eclipse.emf.cdo.examples.ExampleOffline" + wizardID="org.eclipse.emf.cdo.examples.ExampleOfflineWizard" + pageImage="icons/full/wizban/NewEMFExample.gif"> + <projectDescriptor + name="org.eclipse.emf.cdo.examples.client.offline" + contentURI="examples/org.eclipse.emf.cdo.examples.client.offline/" + description="%ExampleOfflineProject_desc"/> + </example> + <example id="org.eclipse.emf.cdo.examples.ExampleModel" wizardID="org.eclipse.emf.cdo.examples.ExampleModelWizard" pageImage="icons/full/wizban/NewEMFExample.gif"> |