Author: rombert Date: Thu Oct 9 22:31:40 2014 New Revision: 1630609 URL: http://svn.apache.org/r1630609 Log: SLING-4021 - Set publish interval to 0 when creating a new server
Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/OverridePublishIntervalFragment.java Modified: sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF sling/trunk/tooling/ide/eclipse-ui/plugin.xml Modified: sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF?rev=1630609&r1=1630608&r2=1630609&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF (original) +++ sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF Thu Oct 9 22:31:40 2014 @@ -68,6 +68,7 @@ Import-Package: javax.jcr, org.eclipse.wst.server.ui, org.eclipse.wst.server.ui.editor, org.eclipse.wst.server.ui.internal, + org.eclipse.wst.server.ui.wizard, org.osgi.framework, org.osgi.service.component, org.osgi.service.event;version="1.3.0", Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1630609&r1=1630608&r2=1630609&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original) +++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Thu Oct 9 22:31:40 2014 @@ -70,7 +70,17 @@ typeIds="org.apache.sling.ide.launchpadServer" class="org.apache.sling.ide.eclipse.ui.internal.InstallEditorSection"> </section> - </extension> + </extension> + + <!-- hook in the server creation wizard --> + <extension + point="org.eclipse.wst.server.ui.wizardFragments"> + <fragment + class="org.apache.sling.ide.eclipse.ui.wizards.OverridePublishIntervalFragment" + id="org.apache.sling.ide.eclipse.ui.wizards.SomeWizardFragment" + typeIds="org.apache.sling.ide.launchpadServer"> + </fragment> + </extension> <!-- Runtime images --> <extension point="org.eclipse.wst.common.project.facet.ui.images"> Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/OverridePublishIntervalFragment.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/OverridePublishIntervalFragment.java?rev=1630609&view=auto ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/OverridePublishIntervalFragment.java (added) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/OverridePublishIntervalFragment.java Thu Oct 9 22:31:40 2014 @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sling.ide.eclipse.ui.wizards; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.TaskModel; +import org.eclipse.wst.server.ui.wizard.WizardFragment; + +/** + * The <tt>OverridePublishIntervalFragment</tt> ensures that the publish interval is set to 0 when creating a Sling + * Runtime + * + */ +public class OverridePublishIntervalFragment extends WizardFragment { + + @Override + public boolean hasComposite() { + return false; + } + + @Override + public void performFinish(IProgressMonitor monitor) throws CoreException { + + IServer server = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER); + if (server instanceof IServerWorkingCopy) { + IServerWorkingCopy wc = (IServerWorkingCopy) server; + wc.setAttribute("auto-publish-time", 0); + wc.save(true, monitor); + } + + } + +}