Skip to content
Open
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
1 change: 1 addition & 0 deletions org.sofproject.gst.topo/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Require-Bundle: org.sofproject.core,
org.sofproject.ui,
org.sofproject.topo.ui,
com.jcraft.jsch
Export-Package: org.sofproject.gst.topo
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@

public interface IGstNodeConst {
String GST_NODE_CORE_ID = "org.sofproject.gst.topo";
String GST_NODE_PREFERENCES_ID = "org.sofproject.ui.preferences";

String GST_NODE_EXTENSION_ID = GST_NODE_CORE_ID + ".gstextension";

String GST_PROJ_DEFAULT_GST_INSPECT_TOOL_CMD = "gst-inspect-1.0";
String GST_PROJ_DEFAULT_GST_LAUNCH_TOOL_CMD = "gst-launch-1.0";

String GST_PROJ_PROP_GST_INSPECT_TOOL_CMD = "gstInspectToolCmd";
String GST_PROJ_PROP_GST_LAUNCH_TOOL_CMD = "gstLaunchToolCmd";

String GST_LAUNCH_PREF_NAME = "gstLaunch";
String GST_INSPECT_PREF_NAME = "gstInspect";
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

package org.sofproject.gst.topo.ui.wizards;

import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
Expand All @@ -39,6 +40,7 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.sofproject.gst.topo.GstNodeExtension;
import org.sofproject.gst.topo.IGstNodeConst;
import org.sofproject.ui.wizards.INewNodeExtensionPage;

public class GstNodeNewPage extends WizardPage implements INewNodeExtensionPage {
Expand All @@ -64,22 +66,23 @@ public GstNodeNewPage(GstNodeExtension gstNode) {
@Override
public void createControl(Composite parent) {
Composite control = new Composite(parent, SWT.NULL);
initializeDialogUnits(parent);
control.setLayout(new GridLayout());
control.setLayoutData(new GridData(GridData.FILL_BOTH));

Composite inspectGroup = new Composite(control, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
inspectGroup.setLayout(layout);
inspectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(inspectGroup, SWT.NONE).setText("gst-inspect command");
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.grabExcessHorizontalSpace = true;
gstInspectToolCmd = new Text(inspectGroup, SWT.BORDER);
gstInspectToolCmd.setLayoutData(data);
gstInspectToolCmd.setText(gstNode.getGstInspectToolCmd());
gstInspectToolCmd.addListener(SWT.Modify, confModifyListener);
initializeDialogUnits(parent);
control.setLayout(new GridLayout());
control.setLayoutData(new GridData(GridData.FILL_BOTH));

Composite inspectGroup = new Composite(control, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
inspectGroup.setLayout(layout);
inspectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(inspectGroup, SWT.NONE).setText("gst-inspect command");
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.grabExcessHorizontalSpace = true;
gstInspectToolCmd = new Text(inspectGroup, SWT.BORDER);
gstInspectToolCmd.setLayoutData(data);
gstInspectToolCmd.setText(Platform.getPreferencesService().getString(IGstNodeConst.GST_NODE_PREFERENCES_ID,
IGstNodeConst.GST_INSPECT_PREF_NAME, gstNode.getGstInspectToolCmd(), null));
gstInspectToolCmd.addListener(SWT.Modify, confModifyListener);

Composite launchGroup = new Composite(control, SWT.NONE);
layout = new GridLayout();
Expand All @@ -91,11 +94,12 @@ public void createControl(Composite parent) {
data.grabExcessHorizontalSpace = true;
gstLaunchToolCmd = new Text(launchGroup, SWT.BORDER);
gstLaunchToolCmd.setLayoutData(data);
gstLaunchToolCmd.setText(gstNode.getGstLaunchToolCmd());
gstLaunchToolCmd.setText(Platform.getPreferencesService().getString(IGstNodeConst.GST_NODE_PREFERENCES_ID,
IGstNodeConst.GST_LAUNCH_PREF_NAME, gstNode.getGstLaunchToolCmd(), null));
gstLaunchToolCmd.addListener(SWT.Modify, confModifyListener);

setControl(control);
Dialog.applyDialogFont(control);
Dialog.applyDialogFont(control);
}

protected boolean validatePage() {
Expand Down
4 changes: 3 additions & 1 deletion org.sofproject.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ Export-Package: org.sofproject.ui.editor,
org.sofproject.ui.properties,
org.sofproject.ui.wizards
Bundle-Vendor: Intel Corporation
Import-Package: com.google.common.collect;version="21.0.0"
Import-Package: com.google.common.collect;version="21.0.0",
org.sofproject.gst.topo

7 changes: 7 additions & 0 deletions org.sofproject.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,11 @@
name="Audio Development">
</perspective>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page id="org.sofproject.ui.preferences.gstcommandspreferences"
class="org.sofproject.ui.preferences.GstCommandsPreferences"
name="GStreamer commands">
</page>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2019, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Intel Corporation nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

package org.sofproject.ui.preferences;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.sofproject.gst.topo.IGstNodeConst;

public class GstCommandsPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

private StringFieldEditor gstInspectfieldEditor;
private StringFieldEditor gstLaunchfieldEditor;

public GstCommandsPreferences() {
super(GRID);
setDescription("Set custom GStreamer commands");
}

@Override
public boolean performOk() {
if (gstLaunchfieldEditor.getStringValue().equals("")) {
setErrorMessage("gst-launch command cannot be empty");
return false;
}

if (gstInspectfieldEditor.getStringValue().equals("")) {
setErrorMessage("gst-inspect command cannot be empty");
return false;
}
return super.performOk();
}

@Override
public void init(IWorkbench workbench) {
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE,
IGstNodeConst.GST_NODE_PREFERENCES_ID);

store.setDefault(IGstNodeConst.GST_INSPECT_PREF_NAME, IGstNodeConst.GST_PROJ_DEFAULT_GST_INSPECT_TOOL_CMD);
store.setDefault(IGstNodeConst.GST_LAUNCH_PREF_NAME, IGstNodeConst.GST_PROJ_DEFAULT_GST_LAUNCH_TOOL_CMD);

setPreferenceStore(store);
}

@Override
protected void createFieldEditors() {
gstInspectfieldEditor = new StringFieldEditor(IGstNodeConst.GST_INSPECT_PREF_NAME, "Gst-inspect command: ",
getFieldEditorParent());
addField(gstInspectfieldEditor);

gstLaunchfieldEditor = new StringFieldEditor(IGstNodeConst.GST_LAUNCH_PREF_NAME, "Gst-launch command: ",
getFieldEditorParent());
addField(gstLaunchfieldEditor);
}
}