Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,19 @@ For details, see http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"
unpack="false"/>

<plugin
<plugin
id="org.csstudio.opibuilder.validation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.csstudio.opibuilder.rcp.view"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>

</feature>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.csstudio.opibuilder.runmode.OPIView;
import org.csstudio.opibuilder.util.ErrorHandlerUtil;
import org.csstudio.opibuilder.util.ResourceUtil;
import org.csstudio.opibuilder.util.SingleSourceHelper;
import org.csstudio.opibuilder.util.SingleSourceRuntimeTypeHelper;
import org.csstudio.ui.util.perspective.PerspectiveHelper;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
Expand All @@ -25,7 +25,6 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.part.FileEditorInput;

Expand All @@ -44,16 +43,7 @@ public class EditOPIHandler extends AbstractHandler implements IHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

IOPIRuntime opiRuntime = SingleSourceHelper.getOPIShellForShell(HandlerUtil.getActiveShell(event));
if (opiRuntime == null) {
// if the selected object isn't an OPIShell so grab the
// OPIView or OPIRunner currently selected
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof IOPIRuntime)
{
opiRuntime = (IOPIRuntime)part;
}
}
IOPIRuntime opiRuntime = SingleSourceRuntimeTypeHelper.getOPIRuntimeForEvent(event);

if (opiRuntime != null) {
IPath path = opiRuntime.getDisplayModel().getOpiFilePath();
Expand Down Expand Up @@ -135,7 +125,7 @@ public void setEnabled(Object evaluationContext) {
if (!PreferencesHelper.isNoEdit()) {
if (evaluationContext instanceof IEvaluationContext) {
IWorkbenchPart part = getActivePart((IEvaluationContext) evaluationContext);
IOPIRuntime opiShell = SingleSourceHelper.getOPIShellForShell(
IOPIRuntime opiShell = SingleSourceRuntimeTypeHelper.getOPIRuntimeForShell(
getActiveShell((IEvaluationContext) evaluationContext));
IPath path = null;
if (opiShell != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,4 @@ protected void iOpenEditor(IWorkbenchPage page, IPath path)
String id = defaultEditor.getId();
page.openEditor(new PathEditorInput(path), id);
}

@Override
protected void iOpenOPIShell(IPath path, MacrosInput input) {
}

@Override
protected IOPIRuntime iGetOPIShellForShell(Shell shell) {
return null;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.csstudio.opibuilder.util;

import org.csstudio.opibuilder.runmode.IOPIRuntime;
import org.csstudio.opibuilder.runmode.OPIRunner;
import org.csstudio.opibuilder.runmode.RunModeService.DisplayMode;
import org.csstudio.opibuilder.runmode.RunnerInput;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.IPath;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;

public class SingleSourceRuntimeTypeHelperImpl extends SingleSourceRuntimeTypeHelper {

@Override
protected void iOpenOPIShell(IPath path, MacrosInput input) {
}

@Override
protected IOPIRuntime iGetOPIRuntimeForShell(Shell shell) {
return null;
}

@Override
protected IOPIRuntime iGetOPIRuntimeForEvent(ExecutionEvent event) {
return null;
}

@Override
protected void iOpenDisplay(IWorkbenchPage page, RunnerInput input, DisplayMode mode) {
try
{
page.openEditor(input, OPIRunner.ID);
}
catch (PartInitException e)
{
ErrorHandlerUtil.handleError(NLS.bind("Failed to open {0}.", input.getPath()), e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.csstudio.opibuilder.rcp.opiruntime</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Opiruntime
Bundle-SymbolicName: org.csstudio.opibuilder.rcp.opiruntime;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ITER
Fragment-Host: org.csstudio.opibuilder;bundle-version="4.0.104"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<fragment>
<extension
point="org.eclipse.ui.editors">
<!-- Note regarding name:
In Navigator, the "Open With.." context menu lists *.opi 'editors'
in alphabetical order:
OPI Display (Workspace)
OPI Editor
-->
<editor
class="org.csstudio.opibuilder.runmode.OPIRunner"
contributorClass="org.csstudio.opibuilder.runmode.OPIRunnerToolBarContributor"
default="true"
extensions="opi"
icon="icons/OPIRunner.png"
id="org.csstudio.opibuilder.OPIRunner"
name="OPI Runtime">
</editor>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
class="org.csstudio.opibuilder.runmode.OPIPerspective"
icon="icons/OPIBuilder.png"
id="org.csstudio.opibuilder.OPIRuntime.perspective"
name="OPI Runtime">
</perspective>
</extension>
<!--extension
point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="false"
id="org.csstudio.opibuilder.openRuntimePerspective"
objectClass="org.csstudio.opibuilder.editparts.AbstractBaseEditPart">
<action
class="org.csstudio.opibuilder.actions.OpenOPIRuntimePerspectiveAction"
icon="icons/OPIRunner.png"
id="org.csstudio.opibuilder.openRuntimePerspective"
label="OPI Runtime Perspective"
menubarPath="ui">
</action>
<visibility>
<objectState
name="executionMode"
value="RUN_MODE">
</objectState>
</visibility>
</objectContribution>
</extension-->
</fragment>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.csstudio</groupId>
<artifactId>opibuilder-plugins</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.csstudio.opibuilder.rcp.opiruntime</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.csstudio.opibuilder.runmode;

import org.eclipse.ui.IPageLayout;

/**
*
* <code>OPIPerspective</code> is an override of the original OPI Runtime perspective,
* which does not use the editor area.
*
* @author <a href="mailto:[email protected]">Jaka Bobnar</a>
*
*/
public class OPIPerspective extends OPIRunnerPerspective {

@Override
public void createInitialLayout(IPageLayout layout) {
super.createInitialLayout(layout);
layout.setEditorAreaVisible(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package org.csstudio.opibuilder.util;

import org.csstudio.opibuilder.runmode.IOPIRuntime;
import org.csstudio.opibuilder.runmode.OPIRunner;
import org.csstudio.opibuilder.runmode.OPIRunnerPerspective;
import org.csstudio.opibuilder.runmode.RunModeService.DisplayMode;
import org.csstudio.opibuilder.runmode.RunnerInput;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.IPath;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IPageListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.handlers.HandlerUtil;

public class SingleSourceRuntimeTypeHelperImpl extends SingleSourceRuntimeTypeHelper {

private IWorkbenchWindow runWindow;

@Override
protected IOPIRuntime iGetOPIRuntimeForEvent(ExecutionEvent event) {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
return part instanceof IOPIRuntime ? (IOPIRuntime)part : null;
}

@Override
protected void iOpenOPIShell(IPath path, MacrosInput input) {
try {
if (runWindow == null) {
runWindow = PlatformUI.getWorkbench().openWorkbenchWindow(
OPIRunnerPerspective.ID, null);
runWindow.addPageListener(new IPageListener() {
public void pageClosed(IWorkbenchPage page) {
runWindow = null;
}

public void pageActivated(IWorkbenchPage page) {
// NOP
}

public void pageOpened(IWorkbenchPage page) {
// NOP
}
});
}
IWorkbenchPage page = runWindow.getActivePage();
Shell shell = runWindow.getShell();
if (shell.getMinimized())
shell.setMinimized(false);
shell.forceActive();
shell.forceFocus();
iOpenDisplay(page, new RunnerInput(path, null, input), DisplayMode.NEW_TAB);
shell.moveAbove(null);
} catch (WorkbenchException e) {
ErrorHandlerUtil.handleError(NLS.bind("Failed to open {0}", path), e);
}
}

@Override
protected IOPIRuntime iGetOPIRuntimeForShell(Shell shell) {
return null;
}

@Override
protected void iOpenDisplay(IWorkbenchPage page, RunnerInput input, DisplayMode mode) {
try {
page.openEditor(input, OPIRunner.ID);
} catch (PartInitException e) {
ErrorHandlerUtil.handleError(NLS.bind("Failed to open {0}", input.getPath()), e);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.csstudio.opibuilder.rcp.view</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: View
Bundle-SymbolicName: org.csstudio.opibuilder.rcp.view;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ITER
Fragment-Host: org.csstudio.opibuilder;bundle-version="4.0.104"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.ui.ide
Import-Package: javafx.beans.property;version="2.2.0",
javafx.collections;version="2.2.0",
javafx.event;version="2.2.0",
javafx.geometry;version="2.2.0",
javafx.scene;version="2.2.0",
javafx.scene.control;version="2.2.0",
javafx.scene.layout;version="2.2.0",
org.eclipse.fx.ui.workbench3,
org.eclipse.gef.ui.actions
Loading