use of org.eclipse.jface.resource.LocalResourceManager in project yamcs-studio by yamcs.
the class ArchiveView method createPartControl.
@Override
public void createPartControl(Composite parent) {
ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
seekImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/seek.png"));
playImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/play.png"));
pauseImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/pause.png"));
forwardImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/forward.png"));
forward2xImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/forward2x.png"));
forward4xImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/forward4x.png"));
forward8xImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/forward8x.png"));
forward16xImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/forward16x.png"));
leaveReplayImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ArchiveView.class, "icons/redo.png"));
createActions();
indexReceiver = new ArchiveIndexReceiver();
parent.setLayout(new FillLayout());
Composite contentArea = new Composite(parent, SWT.NONE);
contentArea.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout gl = new GridLayout();
gl.marginWidth = 0;
gl.marginHeight = 0;
contentArea.setLayout(gl);
Composite locationComp = new Composite(contentArea, SWT.EMBEDDED);
locationComp.setLayoutData(new GridData(GridData.FILL_BOTH));
java.awt.Frame frame = SWT_AWT.new_Frame(locationComp);
archivePanel = new ArchivePanel(this);
archivePanel.setPreferredSize(new Dimension(300, 400));
frame.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
archivePanel.onWindowResized();
}
});
frame.add(archivePanel);
replayComposite = new Composite(contentArea, SWT.NONE);
replayCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
replayComposite.setLayoutData(replayCompositeGridData);
gl = new GridLayout(4, false);
gl.marginHeight = 0;
gl.verticalSpacing = 0;
gl.horizontalSpacing = 0;
replayComposite.setLayout(gl);
// current time / jump date / jump time / jump button
Composite timeComposite = new Composite(replayComposite, SWT.NONE);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
// gd.widthHint = 140;
// gd.grabExcessHorizontalSpace = true;
timeComposite.setLayoutData(gd);
gl = new GridLayout(4, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
gl.verticalSpacing = 0;
gl.horizontalSpacing = 0;
timeComposite.setLayout(gl);
replayTimeLabel = new Label(timeComposite, SWT.NONE);
FontData[] fd = replayTimeLabel.getFont().getFontData();
fd[0].setHeight(fd[0].getHeight() - 2);
// TODO dispose this font!
replayTimeLabel.setFont(new Font(parent.getDisplay(), fd));
// ugh...
replayTimeLabel.setText(" ");
seekDate = new DateTime(timeComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
seekTime = new DateTime(timeComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
seekButton = new Button(timeComposite, SWT.PUSH);
seekButton.setImage(seekImage);
seekButton.setToolTipText("Seek Specified Time");
seekButton.addListener(SWT.Selection, evt -> {
long seekInstant = TimeEncoding.fromCalendar(RCPUtils.toCalendar(seekDate, seekTime));
archivePanel.seekReplay(seekInstant);
});
// play / pause / forward
Composite controlsComposite = new Composite(replayComposite, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.CENTER;
gd.grabExcessHorizontalSpace = true;
controlsComposite.setLayoutData(gd);
gl = new GridLayout(3, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
gl.verticalSpacing = 0;
gl.horizontalSpacing = 0;
controlsComposite.setLayout(gl);
playButton = new Button(controlsComposite, SWT.PUSH);
playButton.setImage(playImage);
playButton.setToolTipText("Play");
playButton.addListener(SWT.Selection, evt -> {
if (playButton.getImage().equals(playImage))
RCPUtils.runCommand("org.yamcs.studio.core.ui.processor.playCommand");
else
RCPUtils.runCommand("org.yamcs.studio.core.ui.processor.pauseCommand");
});
forwardButton = new Button(controlsComposite, SWT.PUSH);
forwardButton.setImage(forwardImage);
forwardButton.setToolTipText("Forward");
forwardButton.addListener(SWT.Selection, evt -> {
RCPUtils.runCommand("org.yamcs.studio.core.ui.processor.forwardCommand");
});
Composite buttonWrapper = new Composite(replayComposite, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.RIGHT;
gd.widthHint = 140;
buttonWrapper.setLayoutData(gd);
gl = new GridLayout();
gl.horizontalSpacing = 0;
gl.verticalSpacing = 0;
gl.marginHeight = 0;
gl.marginWidth = 0;
buttonWrapper.setLayout(gl);
leaveReplayButton = new Button(buttonWrapper, SWT.PUSH);
leaveReplayButton.setImage(leaveReplayImage);
leaveReplayButton.setToolTipText("Back to Realtime");
leaveReplayButton.addListener(SWT.Selection, evt -> {
RCPUtils.runCommand("org.yamcs.studio.core.ui.processor.leaveReplay");
});
gd = new GridData();
gd.horizontalAlignment = SWT.RIGHT;
buttonWrapper.setLayoutData(gd);
ISourceProviderService service = (ISourceProviderService) getSite().getService(ISourceProviderService.class);
processorState = (ProcessorStateProvider) service.getSourceProvider(ProcessorStateProvider.STATE_KEY_PROCESSING);
processorState.addSourceProviderListener(this);
connectionState = (ConnectionStateProvider) service.getSourceProvider(ConnectionStateProvider.STATE_KEY_CONNECTED);
connectionState.addSourceProviderListener(this);
indexReceiver.setIndexListener(this);
TimeCatalogue.getInstance().addTimeListener(this);
YamcsPlugin.getDefault().addYamcsConnectionListener(this);
ManagementCatalogue.getInstance().addInstanceListener(this);
updateState();
}
use of org.eclipse.jface.resource.LocalResourceManager in project yamcs-studio by yamcs.
the class StyleEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
tk = new FormToolkit(parent.getDisplay());
Composite formWrapper = tk.createComposite(parent);
GridLayout gl = new GridLayout();
formWrapper.setLayout(gl);
form = tk.createScrolledForm(formWrapper);
form.setText("Style Editor");
form.setLayoutData(new GridData(GridData.FILL_BOTH));
gl = new GridLayout();
form.getBody().setLayout(gl);
Section section = tk.createSection(form.getBody(), Section.TITLE_BAR);
section.setText("Colors");
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
StyleDefinition def = loadData(parent.getDisplay());
ManagedForm managedForm = new ManagedForm(tk, form);
resourceManager = new LocalResourceManager(JFaceResources.getResources());
new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(managedForm);
ManagedForm fontsMForm = new ManagedForm(tk, form);
section = tk.createSection(form.getBody(), Section.TITLE_BAR);
section.setText("Fonts");
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new ThemeColorBlock(def, parent.getDisplay(), resourceManager).createContent(fontsMForm);
}
Aggregations