You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ha...@apache.org on 2011/08/24 11:56:41 UTC
svn commit: r1161032 - in
/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui:
actions/ commands/ sections/
Author: hanhongfang
Date: Wed Aug 24 09:56:40 2011
New Revision: 1161032
URL: http://svn.apache.org/viewvc?rev=1161032&view=rev
Log:
code style format for rev1161030.
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/actions/ChangeBundleStartLevelAction.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetDefaultOSGIBundleStartLevel.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorSetOSGIBundleStartLevelSection.java
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/actions/ChangeBundleStartLevelAction.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/actions/ChangeBundleStartLevelAction.java?rev=1161032&r1=1161031&r2=1161032&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/actions/ChangeBundleStartLevelAction.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/actions/ChangeBundleStartLevelAction.java Wed Aug 24 09:56:40 2011
@@ -16,7 +16,6 @@
*/
package org.apache.geronimo.st.v30.ui.actions;
-
import org.apache.geronimo.st.v30.core.GeronimoServerBehaviourDelegate;
import org.apache.geronimo.st.v30.core.base.Bundle;
import org.apache.geronimo.st.v30.core.internal.Trace;
@@ -37,84 +36,86 @@ import org.eclipse.wst.server.ui.interna
@SuppressWarnings("restriction")
public class ChangeBundleStartLevelAction implements IObjectActionDelegate {
- private Server server;
- private IModule[] module;
-
- @Override
- public void run(IAction arg0) {
- ObjectPluginAction action = (ObjectPluginAction) arg0;
- TreeSelection selection = (TreeSelection)action.getSelection();
- ModuleServer ms = (ModuleServer) selection.getFirstElement();
- module = ms.getModule();
- server = (Server) ms.getServer();
-
- Bundle bundle = getBundle();
- InputDialog diag = new ChangeStartLevelDiag(null, Messages.changeOSGIBundleStartLevel,
- Messages.changeOSGIBundleStartLevelDesc, bundle.getStartLevel() + "", null);
- diag.open();
-
- }
-
- @Override
- public void selectionChanged(IAction arg0, ISelection arg1) {
- }
-
- @Override
- public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
- }
-
- private class ChangeStartLevelDiag extends InputDialog {
-
- public ChangeStartLevelDiag(Shell parentShell, String dialogTitle,
- String dialogMessage, String initialValue,
- IInputValidator validator) {
- super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
- }
-
- @Override
- protected void cancelPressed() {
- super.cancelPressed();
- }
-
- @Override
- protected void okPressed() {
- String value = this.getValue();
- try {
- int level = Integer.parseInt(value);
- Bundle bundle = getBundle();
- bundle.setStartLevel(level);
- super.okPressed();
-
- } catch(Exception e) {
- this.setErrorMessage(Messages.changeOSGIBundleStartLevelDescOnError);
- }
-
- publish(module);
- }
-
- private void publish(IModule[] module) {
- GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
- try {
- delegate.getOsgiModuleHandler().doChanged(module[0], null);
- } catch (Exception e) {
- Trace.trace(Trace.ERROR, e.getMessage(), e, Activator.logActions);
- }
- }
-
- }
-
- private Bundle getBundle() throws RuntimeException {
- Bundle bundle = null;
- GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
- try {
- bundle = delegate.getOsgiModuleHandler().getBundleInfo(module[0]);
- if(bundle == null) throw new NullPointerException("the bundle is inexisted");
-
- return bundle;
- } catch (Exception e) {
- Trace.trace(Trace.ERROR, e.getMessage(), e, Activator.logActions);
- throw new RuntimeException(e);
- }
- }
+ private Server server;
+ private IModule[] module;
+
+ @Override
+ public void run(IAction arg0) {
+ ObjectPluginAction action = (ObjectPluginAction) arg0;
+ TreeSelection selection = (TreeSelection) action.getSelection();
+ ModuleServer ms = (ModuleServer) selection.getFirstElement();
+ module = ms.getModule();
+ server = (Server) ms.getServer();
+
+ Bundle bundle = getBundle();
+ InputDialog diag = new ChangeStartLevelDiag(null, Messages.changeOSGIBundleStartLevel,
+ Messages.changeOSGIBundleStartLevelDesc, bundle.getStartLevel() + "", null);
+ diag.open();
+
+ }
+
+ @Override
+ public void selectionChanged(IAction arg0, ISelection arg1) {
+ }
+
+ @Override
+ public void setActivePart(IAction arg0, IWorkbenchPart arg1) {
+ }
+
+ private class ChangeStartLevelDiag extends InputDialog {
+
+ public ChangeStartLevelDiag(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue,
+ IInputValidator validator) {
+ super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
+ }
+
+ @Override
+ protected void cancelPressed() {
+ super.cancelPressed();
+ }
+
+ @Override
+ protected void okPressed() {
+ String value = this.getValue();
+ try {
+ int level = Integer.parseInt(value);
+ Bundle bundle = getBundle();
+ bundle.setStartLevel(level);
+ super.okPressed();
+
+ } catch (Exception e) {
+ this.setErrorMessage(Messages.changeOSGIBundleStartLevelDescOnError);
+ }
+
+ publish(module);
+ }
+
+ private void publish(IModule[] module) {
+ GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server
+ .getAdapter(GeronimoServerBehaviourDelegate.class);
+ try {
+ delegate.getOsgiModuleHandler().doChanged(module[0], null);
+ } catch (Exception e) {
+ Trace.trace(Trace.ERROR, e.getMessage(), e, Activator.logActions);
+ }
+ }
+
+ }
+
+ private Bundle getBundle() throws RuntimeException {
+ Bundle bundle = null;
+ GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server
+ .getAdapter(GeronimoServerBehaviourDelegate.class);
+ try {
+ bundle = delegate.getOsgiModuleHandler().getBundleInfo(module[0]);
+ if (bundle == null)
+ throw new NullPointerException("the bundle is inexisted");
+
+ return bundle;
+ } catch (Exception e) {
+ Trace.trace(Trace.ERROR, e.getMessage(), e, Activator.logActions);
+ throw new RuntimeException(e);
+ }
+ }
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetDefaultOSGIBundleStartLevel.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetDefaultOSGIBundleStartLevel.java?rev=1161032&r1=1161031&r2=1161032&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetDefaultOSGIBundleStartLevel.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetDefaultOSGIBundleStartLevel.java Wed Aug 24 09:56:40 2011
@@ -21,32 +21,32 @@ import org.apache.geronimo.st.v30.core.o
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.wst.server.core.IServerWorkingCopy;
-
public class SetDefaultOSGIBundleStartLevel extends ServerCommand {
- private Spinner spinner;
- private int value;
- private int oldValue;
-
- public SetDefaultOSGIBundleStartLevel(IServerWorkingCopy server, String name, Spinner spinner) {
- super(server, name);
- this.spinner = spinner;
- this.value = spinner.getSelection();
- }
-
- @Override
- public void execute() {
- oldValue = OsgiConstants.BUNDLE_DEFAULT_START_LEVEL;
- OsgiConstants.BUNDLE_DEFAULT_START_LEVEL = value;
- ModuleArtifactMapper.getInstance().saveDefaultBundleStartLevel(server, OsgiConstants.BUNDLE_DEFAULT_START_LEVEL);
-
- }
-
- @Override
- public void undo() {
- OsgiConstants.BUNDLE_DEFAULT_START_LEVEL = oldValue;
- spinner.setSelection(oldValue);
- ModuleArtifactMapper.getInstance().saveDefaultBundleStartLevel(server, OsgiConstants.BUNDLE_DEFAULT_START_LEVEL);
- }
-
+ private Spinner spinner;
+ private int value;
+ private int oldValue;
+
+ public SetDefaultOSGIBundleStartLevel(IServerWorkingCopy server, String name, Spinner spinner) {
+ super(server, name);
+ this.spinner = spinner;
+ this.value = spinner.getSelection();
+ }
+
+ @Override
+ public void execute() {
+ oldValue = OsgiConstants.BUNDLE_DEFAULT_START_LEVEL;
+ OsgiConstants.BUNDLE_DEFAULT_START_LEVEL = value;
+ ModuleArtifactMapper.getInstance()
+ .saveDefaultBundleStartLevel(server, OsgiConstants.BUNDLE_DEFAULT_START_LEVEL);
+
+ }
+
+ @Override
+ public void undo() {
+ OsgiConstants.BUNDLE_DEFAULT_START_LEVEL = oldValue;
+ spinner.setSelection(oldValue);
+ ModuleArtifactMapper.getInstance()
+ .saveDefaultBundleStartLevel(server, OsgiConstants.BUNDLE_DEFAULT_START_LEVEL);
+ }
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorSetOSGIBundleStartLevelSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorSetOSGIBundleStartLevelSection.java?rev=1161032&r1=1161031&r2=1161032&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorSetOSGIBundleStartLevelSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorSetOSGIBundleStartLevelSection.java Wed Aug 24 09:56:40 2011
@@ -30,8 +30,7 @@ import org.eclipse.ui.forms.widgets.Expa
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
-public class ServerEditorSetOSGIBundleStartLevelSection extends
- AbstractServerEditorSection {
+public class ServerEditorSetOSGIBundleStartLevelSection extends AbstractServerEditorSection {
private Spinner startLevelSpinner;
public ServerEditorSetOSGIBundleStartLevelSection() {
@@ -43,10 +42,8 @@ public class ServerEditorSetOSGIBundleSt
FormToolkit toolkit = getFormToolkit(parent.getDisplay());
- Section section = toolkit.createSection(parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
- | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
- | ExpandableComposite.FOCUS_TITLE);
+ Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
section.setText(Messages.editorSectionOSGIBundleStartLevel);
section.setDescription(Messages.editorSectionOSGIBundleStartLevelDesc);
@@ -68,14 +65,15 @@ public class ServerEditorSetOSGIBundleSt
startLevelSpinner = new Spinner(composite, SWT.BORDER);
startLevelSpinner.setMinimum(1);
startLevelSpinner.setIncrement(1);
- startLevelSpinner.setSelection(ModuleArtifactMapper.getInstance().getServerBundleDefaultStartLevel(server.getOriginal()));
+ startLevelSpinner.setSelection(ModuleArtifactMapper.getInstance().getServerBundleDefaultStartLevel(
+ server.getOriginal()));
startLevelSpinner.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- execute(new SetDefaultOSGIBundleStartLevel(server, Messages.defaultOSGIBundleStartLevel,
- startLevelSpinner));
+ execute(new SetDefaultOSGIBundleStartLevel(server, Messages.defaultOSGIBundleStartLevel,
+ startLevelSpinner));
}
});
}
-
+
}