diff options
author | Tobias Schwarz | 2012-07-18 06:56:05 +0000 |
---|---|---|
committer | Uwe Stieber | 2012-07-18 07:08:33 +0000 |
commit | b818bd7fa3801c8d25e7f5447567064b10b6756e (patch) | |
tree | 0a01ee1062effe30c5f2912d72f9509cb4e2294f /target_explorer/plugins/org.eclipse.tcf.te.launch.ui | |
parent | d1d63a37e70906b8047a95b2225a40f27842b581 (diff) | |
download | org.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.tar.gz org.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.tar.xz org.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.zip |
Target Explorer: ADD launch tab handling in editor
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.launch.ui')
4 files changed, 59 insertions, 55 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties index 32a4fea8e..1a0bc4232 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties @@ -39,8 +39,6 @@ FileTransfers.propertyTab.name=File Transfers General.propertyTab.name=General -SourceLookupEditorPage.name=Source - # ***** Menu Contributions ***** New.menu.name=New diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml index 2e7063b85..d8f860b6c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml @@ -36,12 +36,6 @@ icon="icons/obj16/launches_root.gif" id="org.eclipse.tcf.te.launch.ui.LaunchEditorPage"> </editorPage> - - <editorPage - class="org.eclipse.tcf.te.launch.ui.editor.SourceLookupEditorPage" - name="%SourceLookupEditorPage.name" - id="org.eclipse.tcf.te.launch.ui.SourceLookupEditorPage"> - </editorPage> </extension> <!-- Navigator viewer contributions --> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/AbstractLaunchTabContainerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/AbstractLaunchTabContainerEditorPage.java index de7194fff..0c1cc3a14 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/AbstractLaunchTabContainerEditorPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/AbstractLaunchTabContainerEditorPage.java @@ -21,6 +21,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.tcf.te.launch.ui.tabs.AbstractFormsLaunchConfigurationTab; import org.eclipse.tcf.te.ui.forms.CustomFormToolkit; import org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage; +import org.eclipse.ui.forms.AbstractFormPart; /** * Abstract editor page implementation serving as container for a launch tab. @@ -29,6 +30,8 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto // Reference to the launch configuration tab private final AbstractLaunchConfigurationTab launchTab; + boolean isDirty = false; + /** * Constructor. */ @@ -62,7 +65,7 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto @Override public void dispose() { launchTab.dispose(); - super.dispose(); + super.dispose(); } /* (non-Javadoc) @@ -70,14 +73,14 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto */ @Override protected String getContextHelpId() { - return launchTab.getHelpContextId(); + return launchTab.getHelpContextId(); } /* (non-Javadoc) * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle() */ @Override - protected String getFormTitle() { + protected String getFormTitle() { return launchTab.getName(); } @@ -86,7 +89,15 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto */ @Override protected Image getFormImage() { - return launchTab.getImage(); + return launchTab.getImage(); + } + + /** + * Set the dirty state for this editor page. + * @param dirty The dirty state. + */ + public void setDirty(boolean dirty) { + isDirty = dirty; } /* (non-Javadoc) @@ -104,6 +115,22 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto launchTab.createControl(parent); } + getManagedForm().addPart(new AbstractFormPart() { + @Override + public boolean isDirty() { + return isDirty; + } + + @Override + public void commit(boolean onSave) { + super.commit(onSave); + + if (onSave) { + extractData(); + } + } + }); + // Fix the background color of the launch tab controls Color bg = parent.getBackground(); Control[] children = parent.getChildren(); @@ -113,6 +140,25 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto } /** + * Set the data to the page. + * @param input The editor input. + * @return <code>true</code> if data was set. + */ + public abstract boolean setupData(Object input); + + /** + * Extract the data from the page. + * @return <code>true</code> if data was set. + */ + public abstract boolean extractData(); + + @Override + public void setActive(boolean active) { + super.setActive(active); + setupData(getEditorInput()); + } + + /** * Set the background color of the given controls and their children * to the given color. * @@ -123,12 +169,18 @@ public abstract class AbstractLaunchTabContainerEditorPage extends AbstractCusto Assert.isNotNull(controls); Assert.isNotNull(bg); for (Control c : controls) { - if (!(c instanceof Composite) && !(c instanceof Label) && !(c instanceof Button)) continue; + if (!(c instanceof Composite) && !(c instanceof Label) && !(c instanceof Button)) { + continue; + } if (c instanceof Button) { int style = ((Button)c).getStyle(); - if ((style & SWT.RADIO) == 0 && (style & SWT.CHECK) == 0) continue; + if ((style & SWT.RADIO) == 0 && (style & SWT.CHECK) == 0) { + continue; + } + } + if (!bg.equals(c.getBackground())) { + c.setBackground(bg); } - if (!bg.equals(c.getBackground())) c.setBackground(bg); if (c instanceof Composite) { Control[] children = ((Composite)c).getChildren(); if (children != null && children.length > 0) { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/SourceLookupEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/SourceLookupEditorPage.java deleted file mode 100644 index 09cb7099f..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/editor/SourceLookupEditorPage.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.tcf.te.launch.ui.editor; - -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; - -/** - * Source lookup launch configuration tab container page implementation. - */ -public class SourceLookupEditorPage extends AbstractLaunchTabContainerEditorPage { - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#createLaunchConfigurationTab() - */ - @Override - protected AbstractLaunchConfigurationTab createLaunchConfigurationTab() { - return new SourceLookupTab() { - /* (non-Javadoc) - * @see org.eclipse.debug.ui.sourcelookup.SourceLookupTab#createControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createControl(Composite parent) { - super.createControl(parent); - ((Composite)getControl()).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - } - }; - } - -} |