JBoss Tools SVN: r41555 - in trunk: common/plugins/org.jboss.tools.common.text.xml/META-INF and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-05-30 18:38:55 -0400 (Wed, 30 May 2012)
New Revision: 41555
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/
trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
Make Quick fix for problem markers "Unknown tag" work on temporary WTP annotations https://issues.jboss.org/browse/JBIDE-10958
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/https:/svn.jboss.org/repos/jbosstools/workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml:39727-39732
/workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml:39733-41542
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF 2012-05-30 22:38:55 UTC (rev 41555)
@@ -10,6 +10,7 @@
org.jboss.tools.common.text.xml.contentassist,
org.jboss.tools.common.text.xml.info,
org.jboss.tools.common.text.xml.internal.ui.preferencies,
+ org.jboss.tools.common.text.xml.quickfix,
org.jboss.tools.common.text.xml.ui,
org.jboss.tools.common.text.xml.ui.xpl,
org.jboss.tools.common.text.xml.xpl,
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2012-05-30 22:38:55 UTC (rev 41555)
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension" schema="schema/contentAssistProcessor.exsd"/>
+ <extension-point id="quickFix" name="Quick Fix Generator" schema="schema/quickFix.exsd"/>
<!--
<extension-point id="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.exsd"/>
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.text.xml" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.common.text.xml" id="quickFix" name="Quick Fix Generator"/>
+ </appInfo>
+ <documentation>
+ This extenion point is used to send information about Quick fix generators to QuickFixManager.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="quick-fix-generator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="quick-fix-generator">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="generator-class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ JBoss Tools 3.4
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <extension point="org.jboss.tools.common.text.xml.quickFix">
+ <quick-fix-generator id="seam.searcher" generator-class="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator" />
+</extension>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2009 Red Hat, Inc.
+Distributed under license by Red Hat, Inc. All rights reserved.
+This program is 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:
+Red Hat, Inc. - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -22,7 +22,8 @@
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-import org.jboss.tools.common.text.xml.MarkerAnnotationInfo.AnnotationInfo;
+import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo;
+import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo.AnnotationInfo;
public class BaseQuickAssistProcessor implements IQuickAssistProcessor {
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml.quickfix;
+
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+
+public interface IQuickFixGenerator {
+
+ /**
+ * Returns whether there are any proposals for the given annotation.
+ *
+ * @param annotation the annotation
+ * @return <code>true</code> if there are proposals for the given annotation,
+ * <code>false</code> if not
+ */
+ public boolean hasProposals(Annotation annotation);
+
+ /**
+ * Returns list of proposals for the given annotation (may
+ * be empty).
+ *
+ * @param annotation the annotation
+ * @return list of proposals for the given annotation
+ */
+ public List<ICompletionProposal> getProposals(Annotation annotation);
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml.quickfix;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
+import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+import org.eclipse.wst.sse.ui.StructuredTextInvocationContext;
+import org.eclipse.wst.sse.ui.internal.correction.QuickFixRegistry;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
+
+public class MarkerAnnotationInfo {
+ public final List<AnnotationInfo> infos;
+ public final ISourceViewer viewer;
+
+ public MarkerAnnotationInfo(List<AnnotationInfo> infos, ISourceViewer textViewer) {
+ this.infos = infos;
+ this.viewer = textViewer;
+ }
+
+ public List<ICompletionProposal> getCompletionProposals(AnnotationInfo info) {
+
+ if(info.isTop())
+ return getMarkerProposals(info);
+ else
+ return getProposals(info);
+
+ }
+
+ public List<ICompletionProposal> getMarkerProposals(AnnotationInfo info) {
+ SimpleMarkerAnnotation annotation = (SimpleMarkerAnnotation)info.annotation;
+
+ ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+
+ IMarker marker = annotation.getMarker();
+ IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);
+ for (IMarkerResolution resolution : resolutions) {
+ proposals.add(new QuickFixProposal(resolution, marker));
+ }
+
+ return proposals;
+ }
+
+ public List<ICompletionProposal> getProposals(AnnotationInfo info) {
+ TemporaryAnnotation annotation = (TemporaryAnnotation)info.annotation;
+
+ List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
+ List<IQuickAssistProcessor> processors = new ArrayList<IQuickAssistProcessor>();
+ if (canFix(annotation)) {
+ Object o = annotation.getAdditionalFixInfo();
+ if (o instanceof IQuickAssistProcessor) {
+ processors.add((IQuickAssistProcessor)o);
+ }
+
+ // get all relevant quick fixes for this annotation
+ if(QuickFixManager.getInstance().hasProposals(annotation)){
+ annotation.setAdditionalFixInfo(viewer.getDocument());
+ List<ICompletionProposal> proposals = QuickFixManager.getInstance().getProposals(annotation);
+ allProposals.addAll(proposals);
+ }
+
+ QuickFixRegistry registry = QuickFixRegistry.getInstance();
+ processors.addAll(Arrays.asList(registry.getQuickFixProcessors(annotation)));
+
+ // set up context
+ Map attributes = null;
+ attributes = annotation.getAttributes();
+ StructuredTextInvocationContext sseContext = new StructuredTextInvocationContext(viewer, info.position.getOffset(), info.position.getLength(), attributes);
+
+ // call each processor
+ for (int i = 0; i < processors.size(); ++i) {
+ List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ collectProposals((IQuickAssistProcessor) processors.get(i), annotation, sseContext, proposals);
+
+ if (proposals.size() > 0) {
+ allProposals.addAll(proposals);
+ }
+ }
+
+ }
+
+ return allProposals;
+ }
+
+ private void collectProposals(IQuickAssistProcessor processor, Annotation annotation, IQuickAssistInvocationContext invocationContext, List<ICompletionProposal> proposalsList) {
+ ICompletionProposal[] proposals = processor.computeQuickAssistProposals(invocationContext);
+ if (proposals != null && proposals.length > 0) {
+ proposalsList.addAll(Arrays.asList(proposals));
+ }
+ }
+
+ public boolean canFix(Annotation annotation) {
+ if (annotation instanceof IQuickFixableAnnotation) {
+ if (((IQuickFixableAnnotation) annotation).isQuickFixableStateSet()) {
+ return ((IQuickFixableAnnotation) annotation).isQuickFixable();
+ }
+ }else if(annotation instanceof TemporaryAnnotation){
+ if (((TemporaryAnnotation) annotation).isQuickFixableStateSet()) {
+ return ((TemporaryAnnotation) annotation).isQuickFixable();
+ }
+ }
+ return false;
+ }
+
+ public static class AnnotationInfo {
+ public Annotation annotation;
+ public Position position;
+
+ public AnnotationInfo(Annotation annotation, Position position){
+ this.annotation = annotation;
+ this.position = position;
+ }
+
+ public boolean isTop(){
+ return annotation instanceof SimpleMarkerAnnotation;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,47 @@
+package org.jboss.tools.common.text.xml.quickfix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.text.xml.XmlEditorPlugin;
+
+public class QuickFixExtension {
+ public static String EXTENSION_POINT = "org.jboss.tools.common.text.xml.quickFix"; //$NON-NLS-1$
+
+ String id;
+ IQuickFixGenerator generator;
+
+ public QuickFixExtension() {}
+
+ public String getId() {
+ return id;
+ }
+
+ public IQuickFixGenerator getQuickFixGenerator() {
+ return generator;
+ }
+
+ static QuickFixExtension[] INSTANCES;
+
+ public static QuickFixExtension[] getInstances() {
+ if(INSTANCES != null) return INSTANCES;
+ List<QuickFixExtension> list = new ArrayList<QuickFixExtension>();
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
+ IConfigurationElement[] es = point.getConfigurationElements();
+ for (IConfigurationElement e: es) {
+ QuickFixExtension n = new QuickFixExtension();
+ n.id = e.getAttribute("id"); //$NON-NLS-1$
+ try{
+ n.generator = (IQuickFixGenerator)e.createExecutableExtension("generator-class"); //$NON-NLS-1$
+ }catch(CoreException ex){
+ XmlEditorPlugin.getDefault().logError(ex);
+ }
+ list.add(n);
+ }
+ return INSTANCES = list.toArray(new QuickFixExtension[0]);
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml.quickfix;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+
+public class QuickFixManager {
+ private static QuickFixManager instance = null;
+
+ private HashMap<String, IQuickFixGenerator> generators = new HashMap<String, IQuickFixGenerator>();
+
+ public static QuickFixManager getInstance(){
+ if(instance == null){
+ instance = new QuickFixManager();
+ }
+ return instance;
+ }
+
+ public QuickFixManager(){
+ QuickFixExtension[] extensions = QuickFixExtension.getInstances();
+ for(QuickFixExtension extension : extensions){
+ IQuickFixGenerator generator = extension.getQuickFixGenerator();
+ if(generator != null){
+ addQuickFixGenerator(generator);
+ }
+ }
+ }
+
+ public void addQuickFixGenerator(IQuickFixGenerator generator){
+ if(!generators.containsKey(generator.getClass().toString())){
+ generators.put(generator.getClass().toString(), generator);
+ }
+ }
+
+ public void removeQuickFixGenerator(IQuickFixGenerator generator){
+ generators.remove(generator);
+ }
+
+ public boolean hasProposals(Annotation annotation){
+ for(IQuickFixGenerator generator : generators.values()){
+ if(generator.hasProposals(annotation)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public List<ICompletionProposal> getProposals(Annotation annotation){
+ ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ for(IQuickFixGenerator generator : generators.values()){
+ List<ICompletionProposal> pp = generator.getProposals(annotation);
+ proposals.addAll(pp);
+ }
+
+ return proposals;
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml.quickfix;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+public class QuickFixProposal implements ICompletionProposal{
+ private IMarkerResolution resolution;
+ private IMarker marker;
+
+ public QuickFixProposal(IMarkerResolution resolution, IMarker marker){
+ this.resolution = resolution;
+ this.marker = marker;
+ }
+
+ public void apply(IDocument document) {
+ resolution.run(marker);
+ }
+
+ public Point getSelection(IDocument document) {
+ return null;
+ }
+
+ public String getAdditionalProposalInfo() {
+ if (resolution instanceof IMarkerResolution2)
+ return ((IMarkerResolution2) resolution).getDescription();
+
+ return (String)marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ }
+
+ public String getDisplayString() {
+ return resolution.getLabel();
+ }
+
+ public Image getImage() {
+ if (resolution instanceof IMarkerResolution2)
+ return ((IMarkerResolution2)resolution).getImage();
+ return null;
+ }
+
+ public IContextInformation getContextInformation() {
+ return null;
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -63,8 +63,8 @@
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
-import org.jboss.tools.common.text.xml.MarkerAnnotationInfo;
-import org.jboss.tools.common.text.xml.MarkerAnnotationInfo.AnnotationInfo;
+import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo;
+import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo.AnnotationInfo;
import org.jboss.tools.common.text.xml.TextXMLMessages;
public class MarkerProblemAnnotationHoverProcessor extends ProblemAnnotationHoverProcessor implements ITextHoverExtension, ITextHoverExtension2{
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -176,7 +176,7 @@
ISourceViewer sourceViewer, String partitionType) {
// TODO Auto-generated method stub
// return super.getContentAssistProcessors(sourceViewer, partitionType);
- return new IContentAssistProcessor[0];
+ return null;
}
/**
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2012-05-30 22:38:55 UTC (rev 41555)
@@ -793,4 +793,8 @@
<keywordReference id="org.eclipse.wst.html.ui.webcontent"/>
</page>
</extension>
+
+ <extension point="org.jboss.tools.common.text.xml.quickFix">
+ <quick-fix-generator generator-class="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator" id="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator" />
+ </extension>
</plugin>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -17,12 +17,21 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.web.ui.Messages;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
@@ -33,21 +42,34 @@
* @author Daniel Azarov
*
*/
-public class AddTLDMarkerResolution implements IMarkerResolution2{
+public class AddTLDMarkerResolution implements IMarkerResolution2, ICompletionProposal{
private IFile file;
private Properties properties;
+
private String resolutionName;
+ private int start, end;
+ private String uri, prefix;
public AddTLDMarkerResolution(IFile file, String name, Properties properties){
this.file = file;
this.properties = properties;
this.resolutionName = name;
}
+
+ public AddTLDMarkerResolution(String name, int start, int end, String uri, String prefix){
+ this.resolutionName = name;
+ this.start = start;
+ this.end = end;
+ this.uri = uri;
+ this.prefix = prefix;
+ }
+ @Override
public String getLabel() {
return NLS.bind(Messages.AddTLDMarkerResolution_Name, resolutionName);
}
+ @Override
public void run(IMarker marker) {
FileEditorInput input = new FileEditorInput(file);
IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
@@ -68,11 +90,68 @@
}
}
+ @Override
public String getDescription() {
return getLabel();
}
+ @Override
public Image getImage() {
return null;//ImageDescriptor.createFromFile(AddTLDMarkerResolution.class, "images/xstudio/editors/taglibs_file.gif").createImage(); //$NON-NLS-1$
}
+
+ @Override
+ public void apply(IDocument document) {
+ properties = new Properties();
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
+ properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, ""); //$NON-NLS-1$
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, uri);
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
+ properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
+
+ @Override
+ public void setSelection(ISelection selection) {
+ }
+
+ @Override
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ @Override
+ public ISelection getSelection() {
+ return new TextSelection(start, end-start);
+ }
+
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+ });
+
+
+ Properties p = PaletteTaglibInserter.getPrefixes(document, properties);
+
+ PaletteTaglibInserter inserter = new PaletteTaglibInserter();
+ inserter.inserTaglib(document, properties);
+ }
+
+ @Override
+ public Point getSelection(IDocument document) {
+ return null;
+ }
+
+ @Override
+ public String getAdditionalProposalInfo() {
+ return getDescription();
+ }
+
+ @Override
+ public String getDisplayString() {
+ return getLabel();
+ }
+
+ @Override
+ public IContextInformation getContextInformation() {
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-05-30 21:33:36 UTC (rev 41554)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-05-30 22:38:55 UTC (rev 41555)
@@ -10,14 +10,20 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -26,7 +32,14 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
@@ -37,7 +50,7 @@
* @author Daniel Azarov
*
*/
-public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
+public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator2, IQuickFixGenerator {
private static final String HTML_VALIDATOR_MARKER="org.eclipse.wst.html.core.validationMarker"; //$NON-NLS-1$
private static final String JSP_VALIDATOR_MARKER="org.eclipse.jst.jsp.core.validationMarker"; //$NON-NLS-1$
@@ -60,6 +73,7 @@
private Properties properties;
private String resolutionName;
+ @Override
public IMarkerResolution[] getResolutions(IMarker marker) {
try{
if(isOurCase(marker)){
@@ -73,6 +87,48 @@
return new IMarkerResolution[]{};
}
+ private ICompletionProposal isOurCase(Annotation annotation){
+ if(!(annotation instanceof TemporaryAnnotation)){
+ return null;
+ }
+ TemporaryAnnotation ta = (TemporaryAnnotation)annotation;
+
+
+ String message = annotation.getText();
+ if(ta.getPosition() == null)
+ return null;
+
+ final int start = ta.getPosition().getOffset();
+
+ final int end = ta.getPosition().getOffset()+ta.getPosition().getLength();
+
+ if(!message.startsWith(UNKNOWN_TAG))
+ return null;
+
+ String prefix = getPrifix(message);
+ if(prefix == null)
+ return null;
+
+ if(!libs.containsKey(prefix))
+ return null;
+
+ Object additionalInfo = ta.getAdditionalFixInfo();
+ if(additionalInfo instanceof IDocument){
+ IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument)additionalInfo);
+ IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
+ if(xmlDocument != null && xmlDocument.isXMLType()){
+ resolutionName = "xmlns: "+prefix+" = \""+libs.get(prefix)+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }else{
+ resolutionName = "<%@ taglib uri = \""+libs.get(prefix)+"\" prefix=\""+prefix+"\" %>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ }
+
+
+
+ return new AddTLDMarkerResolution(resolutionName, start, end, libs.get(prefix), prefix);
+ }
+
private boolean isOurCase(IMarker marker) throws CoreException{
String message = (String)marker.getAttribute(IMarker.MESSAGE);
@@ -86,7 +142,7 @@
return false;
final int end = attribute.intValue();
- if(!message.startsWith(UNKNOWN_TAG)) //$NON-NLS-1$
+ if(!message.startsWith(UNKNOWN_TAG))
return false;
String prefix = getPrifix(message);
@@ -115,17 +171,21 @@
properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
+ @Override
public void setSelection(ISelection selection) {
}
+ @Override
public void removeSelectionChangedListener(
ISelectionChangedListener listener) {
}
+ @Override
public ISelection getSelection() {
return new TextSelection(start, end-start);
}
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
}
});
@@ -163,6 +223,7 @@
return prefix;
}
+ @Override
public boolean hasResolutions(IMarker marker) {
try{
String message = (String)marker.getAttribute(IMarker.MESSAGE);
@@ -172,4 +233,20 @@
}
return false;
}
+
+ @Override
+ public boolean hasProposals(Annotation annotation) {
+ String message = annotation.getText();
+ return message.startsWith(UNKNOWN_TAG);
+ }
+
+ @Override
+ public List<ICompletionProposal> getProposals(Annotation annotation) {
+ ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ ICompletionProposal proposal = isOurCase(annotation);
+ if(proposal != null){
+ proposals.add(proposal);
+ }
+ return proposals;
+ }
}
\ No newline at end of file
12 years, 7 months
JBoss Tools SVN: r41554 - trunk/build/aggregate.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-05-30 17:33:36 -0400 (Wed, 30 May 2012)
New Revision: 41554
Modified:
trunk/build/aggregate/build.xml
Log:
https://issues.jboss.org/browse/JBIDE-12058
Modified: trunk/build/aggregate/build.xml
===================================================================
--- trunk/build/aggregate/build.xml 2012-05-30 21:32:22 UTC (rev 41553)
+++ trunk/build/aggregate/build.xml 2012-05-30 21:33:36 UTC (rev 41554)
@@ -525,10 +525,10 @@
<isset property="BUILD_ALIAS" />
</and>
<then>
- <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9.]+)(_.*?)\.(.*?)\.*aggregate" replace=": ${JBT_VERSION}.${BUILD_TS}-H${BUILD_NUMBER}-${BUILD_ALIAS}\4" />
+ <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9x.]+)(_.*?)\.(.*?)\.*aggregate" replace=": ${JBT_VERSION}.${BUILD_TS}-H${BUILD_NUMBER}-${BUILD_ALIAS}\4" />
</then>
<else>
- <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9.]+)(.*).aggregate" replace=": \2.${BUILD_TS}-H${BUILD_NUMBER}\3" />
+ <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9x.]+)(.*).aggregate" replace=": \2.${BUILD_TS}-H${BUILD_NUMBER}\3" />
</else>
</if>
</then>
12 years, 7 months
JBoss Tools SVN: r41553 - branches/jbosstools-3.3.x/build/aggregate.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-05-30 17:32:22 -0400 (Wed, 30 May 2012)
New Revision: 41553
Modified:
branches/jbosstools-3.3.x/build/aggregate/build.xml
Log:
https://issues.jboss.org/browse/JBIDE-12058
Modified: branches/jbosstools-3.3.x/build/aggregate/build.xml
===================================================================
--- branches/jbosstools-3.3.x/build/aggregate/build.xml 2012-05-30 21:26:51 UTC (rev 41552)
+++ branches/jbosstools-3.3.x/build/aggregate/build.xml 2012-05-30 21:32:22 UTC (rev 41553)
@@ -525,10 +525,10 @@
<isset property="BUILD_ALIAS" />
</and>
<then>
- <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9.]+)(_.*?)\.(.*?)\.*aggregate" replace=": ${JBT_VERSION}.${BUILD_TS}-H${BUILD_NUMBER}-${BUILD_ALIAS}\4" />
+ <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9x.]+)(_.*?)\.(.*?)\.*aggregate" replace=": ${JBT_VERSION}.${BUILD_TS}-H${BUILD_NUMBER}-${BUILD_ALIAS}\4" />
</then>
<else>
- <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9.]+)(.*).aggregate" replace=": \2.${BUILD_TS}-H${BUILD_NUMBER}\3" />
+ <propertyregex override="true" property="update.site.version" defaultvalue="${JOB_NAME}" input="${JOB_NAME}" regexp="(jboss|soa)tools-([0-9x.]+)(.*).aggregate" replace=": \2.${BUILD_TS}-H${BUILD_NUMBER}\3" />
</else>
</if>
</then>
12 years, 7 months
JBoss Tools SVN: r41552 - trunk/build/parent.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-05-30 17:26:51 -0400 (Wed, 30 May 2012)
New Revision: 41552
Modified:
trunk/build/parent/pom.xml
Log:
remove jbosstools-staging-aggregate-soa-tooling from profiles which turn themselves on unexpectedly when swtbot.test.skip=false
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2012-05-30 21:26:08 UTC (rev 41551)
+++ trunk/build/parent/pom.xml 2012-05-30 21:26:51 UTC (rev 41552)
@@ -474,39 +474,6 @@
</repository>
</repositories>
</profile>
- <profile>
- <id>jbosstools-staging-aggregate-soa-tooling</id>
- <activation>
- <property>
- <name>swtbot.test.skip</name>
- <value>false</value>
- </property>
- </activation>
- <repositories>
- <repository>
- <id>jbosstools-nightly-soa-tooling</id>
- <url>${jbosstools-nightly-soa-tooling}</url>
- <layout>p2</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- <repository>
- <id>jbosstools-nightly-soa-tooling-tests</id>
- <url>${jbosstools-nightly-soa-tooling-tests}</url>
- <layout>p2</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- </repositories>
- </profile>
<!-- same contents as jboss-requirements-composite-mirror, but locally
available (to improve network lag) -->
12 years, 7 months
JBoss Tools SVN: r41551 - branches/jbosstools-3.3.x/build/parent.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-05-30 17:26:08 -0400 (Wed, 30 May 2012)
New Revision: 41551
Modified:
branches/jbosstools-3.3.x/build/parent/pom.xml
Log:
remove jbosstools-staging-aggregate-soa-tooling from profiles which turn themselves on unexpectedly when swtbot.test.skip=false
Modified: branches/jbosstools-3.3.x/build/parent/pom.xml
===================================================================
--- branches/jbosstools-3.3.x/build/parent/pom.xml 2012-05-30 20:52:42 UTC (rev 41550)
+++ branches/jbosstools-3.3.x/build/parent/pom.xml 2012-05-30 21:26:08 UTC (rev 41551)
@@ -484,39 +484,6 @@
</repository>
</repositories>
</profile>
- <profile>
- <id>jbosstools-staging-aggregate-soa-tooling</id>
- <activation>
- <property>
- <name>swtbot.test.skip</name>
- <value>false</value>
- </property>
- </activation>
- <repositories>
- <repository>
- <id>jbosstools-nightly-soa-tooling</id>
- <url>${jbosstools-nightly-soa-tooling}</url>
- <layout>p2</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- <!-- remove this to avoid circular dependency <repository>
- <id>jbosstools-nightly-soa-tooling-tests</id>
- <url>${jbosstools-nightly-soa-tooling-tests}</url>
- <layout>p2</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository> -->
- </repositories>
- </profile>
<!-- same contents as jboss-requirements-composite-mirror, but locally
available (to improve network lag) -->
12 years, 7 months
JBoss Tools SVN: r41550 - in branches/jbosstools-3.3.x/esb/tests: org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dpalmer
Date: 2012-05-30 16:52:42 -0400 (Wed, 30 May 2012)
New Revision: 41550
Modified:
branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/pom.xml
branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
Log:
Copied test changes from trunk to the 3.3.x branch
Modified: branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/pom.xml
===================================================================
--- branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/pom.xml 2012-05-30 20:50:08 UTC (rev 41549)
+++ branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/pom.xml 2012-05-30 20:52:42 UTC (rev 41550)
@@ -13,7 +13,7 @@
<packaging>eclipse-test-plugin</packaging>
<properties>
- <systemProperties>-Djbosstools.test.jboss.home.4.2=${requirement.build.root}/jboss-soa-p.5.0.0/jboss-as -Djbosstools.test.jboss.home.5.0=${requirement.build.root}/jboss-soa-p.5.0.0/jboss-as -Djbosstools.test.jboss.home.5.1=${requirement.build.root}/jboss-5.1.0.GA -Djbosstools.test.soap.home.4.3=${requirement.build.root}/jboss-soa-p.4.3.0 -Djbosstools.test.soap.home.5.0=${requirement.build.root}/jboss-soa-p.5.0.0</systemProperties>
+ <systemProperties>-Djbosstools.test.jboss.home.4.2=${requirement.build.root}/jboss-soa-p.5.0.0/jboss-soa-p.5.0.0/jboss-as -Djbosstools.test.jboss.home.5.0=${requirement.build.root}/jboss-soa-p.5.0.0/jboss-soa-p.5.0.0/jboss-as -Djbosstools.test.jboss.home.5.1=${requirement.build.root}/jboss-5.1.0.GA -Djbosstools.test.soap.home.4.3=${requirement.build.root}/jboss-soa-p.4.3.0/jboss-soa-p.4.3.0/ -Djbosstools.test.soap.home.5.0=${requirement.build.root}/jboss-soa-p.5.0.0/jboss-soa-p.5.0.0/</systemProperties>
<coverage.filter>org.jboss.tools.esb.core*</coverage.filter>
<emma.instrument.bundles>org.jboss.tools.esb.project.core</emma.instrument.bundles>
</properties>
@@ -31,4 +31,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java
===================================================================
--- branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java 2012-05-30 20:50:08 UTC (rev 41549)
+++ branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.project.core.test/src/org/jboss/tools/esb/project/core/test/ESBProjectDeploymentTest.java 2012-05-30 20:52:42 UTC (rev 41550)
@@ -226,12 +226,14 @@
IClasspathEntry[] entry = initializer.getEntries(path);//jproject.getRawClasspath();
List<String> jars = new ArrayList<String>();
+ /* ldimaggi - display list of jars in the assert text - https://issues.jboss.org/browse/JBDS-2152 */
+ String jarsString = null;
for(IClasspathEntry ent :entry){
jars.add(ent.getPath().lastSegment());
+ jarsString = jarsString + ent.getPath().lastSegment() + " ";
}
+ assertEquals("unable to read User customized ESB runtime, jbossesb-rosetta.jar is not in classpath." + jarsString, true, jars.contains("jbossesb-rosetta.jar"));
- assertEquals("unalbe to read User customized ESB runtime, jbossesb-rosetta.jar is not in classpath.", true, jars.contains("jbossesb-rosetta.jar"));
-
}
public void testSOAP50Deployment() throws Exception {
@@ -351,7 +353,7 @@
protected void createServer(String runtimeID, String serverID,
String location, String configuration) throws CoreException {
// if file doesnt exist, abort immediately.
- assertTrue(new Path(location).toFile().exists());
+ assertTrue("server location " + location + " does not exist", new Path(location).toFile().exists());
currentRuntime = createRuntime(runtimeID, location, configuration);
IServerType serverType = ServerCore.findServerType(serverID);
Modified: branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
===================================================================
--- branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-05-30 20:50:08 UTC (rev 41549)
+++ branches/jbosstools-3.3.x/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-05-30 20:52:42 UTC (rev 41550)
@@ -222,7 +222,9 @@
* @return
*/
protected String getRunningSoaVersionTreeLabel() {
- String ret = "ESB for SOA-P ";
+ String ret = "ESB for JBoss Enterprise SOA Platform ";
+ //String ret = "ESB for SOA-P ";
+
if (!configuredState.getServer().isConfigured) {
throw new NullPointerException("No server was configured for test, but it is required");
}
12 years, 7 months
JBoss Tools SVN: r41549 - trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-05-30 16:50:08 -0400 (Wed, 30 May 2012)
New Revision: 41549
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
Log:
JBIDE-11683 - Enable defining runtime download using external xml file
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-30 20:06:22 UTC (rev 41548)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-30 20:50:08 UTC (rev 41549)
@@ -131,7 +131,7 @@
String directory = System.getProperty(JBOSS_RUNTIME_DIRECTORY, null);
if (directory == null) {
// else use Maven-generated value (or fall back to default)
- return JBOSS_DIRECTORY_URL;
+ return JBOSS_RUNTIME_URL;
}
return directory;
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties 2012-05-30 20:06:22 UTC (rev 41548)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties 2012-05-30 20:50:08 UTC (rev 41549)
@@ -1 +1,2 @@
-discovery.url=${jboss.discovery.directory.url}
\ No newline at end of file
+discovery.url=${jboss.discovery.directory.url}
+runtime.url=${jboss.runtime.directory.url}
\ No newline at end of file
12 years, 7 months
JBoss Tools SVN: r41548 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/action and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-05-30 16:06:22 -0400 (Wed, 30 May 2012)
New Revision: 41548
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
Log:
Fixed - JBIDE-12018
first time I open Port forwarding on an app it pops up the dialog and closes it again instantly
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-30 19:57:55 UTC (rev 41547)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -331,7 +331,7 @@
@Override
protected void onPageActivated(DataBindingContext dbc) {
- final Job j = new Job("Retrieving application's forwardable ports...") {
+ final Job j = new Job("Loading application's forwardable ports...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
@@ -350,18 +350,11 @@
}
};
- getContainer().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- IStatus status = WizardUtils.runInWizard(j, getContainer(), getDataBindingContext());
- if(!status.isOK()) {
- getWizard().getContainer().getShell().close();
- }
- } catch(Exception e) {
- // ignore
- }
- }
- });
+ try {
+ WizardUtils.runInWizard(j, getContainer(), getDataBindingContext());
+ } catch (Exception e) {
+ Logger.error("Failed to load application's forwardable ports", e);
+ }
}
private void refreshViewerInput() {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java 2012-05-30 19:57:55 UTC (rev 41547)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -1,25 +1,22 @@
package org.jboss.tools.openshift.express.internal.ui.action;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingWizard;
import org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingWizardDialog;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.job.RetrieveApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.VerifySSHSessionJob;
import com.openshift.client.IApplication;
-import com.openshift.client.OpenShiftSSHOperationException;
-public class ApplicationPortForwardingAction extends AbstractSSHAction {
+public class ApplicationPortForwardingAction extends AbstractAction {
public ApplicationPortForwardingAction() {
super("Port forwarding...", DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT));
@@ -35,9 +32,9 @@
if (selection != null && selection instanceof ITreeSelection) {
Object sel = ((ITreeSelection) selection).getFirstElement();
if (sel instanceof IApplication) {
- openPortForwardingDialog((IApplication) sel);
+ openPortForwardingDialogFor((IApplication) sel);
} else if (sel instanceof IServer) {
- openPortForwardingDialog((IServer) sel);
+ openPortForwardingDialogFor((IServer) sel);
}
}
}
@@ -49,62 +46,53 @@
*
* @param server
*/
- private void openPortForwardingDialog(final IServer server) {
- Job job = new Job("Identifying OpenShift Application from selected Server...") {
+ private void openPortForwardingDialogFor(final IServer server) {
+ final RetrieveApplicationJob job = new RetrieveApplicationJob(server);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- final IApplication application = ExpressServerUtils.getApplication(server);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- openPortForwardingDialog(application);
- }
- });
- return Status.OK_STATUS;
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ final IApplication application = job.getApplication();
+ openPortForwardingDialogFor(application);
+ }
}
- };
+ });
job.setUser(true);
job.schedule();
}
- private void openPortForwardingDialog(final IApplication application) {
- Job job = new Job("Retrieving application's forwardable ports...") {
+ private void openPortForwardingDialogFor(final IApplication application) {
+ final VerifySSHSessionJob job = new VerifySSHSessionJob(application);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- verifyApplicationSSHSession(application);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- runAsync(application);
- }
- });
- return Status.OK_STATUS;
- } catch (OpenShiftSSHOperationException e) {
- return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK() && job.isValidSession()) {
+ openWizardDialog(application);
}
}
- };
+ });
+
job.setUser(true);
job.schedule();
}
/**
+ * Opens the Port Forwarding dialog for good...
+ *
* @param application
*/
- private void runAsync(final IApplication application) {
- try {
- ApplicationPortForwardingWizard wizard = new ApplicationPortForwardingWizard(
- application);
- WizardDialog dialog = new ApplicationPortForwardingWizardDialog(Display.getCurrent()
- .getActiveShell(),
- wizard);
- dialog.setMinimumPageSize(700, 300);
- dialog.create();
- dialog.open();
- } catch (Exception e) {
- Logger.error(
- "Failed to perform 'port-forwarding' for application '" + application.getName()
- + "'", e);
- }
+ private void openWizardDialog(final IApplication application) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ApplicationPortForwardingWizard wizard = new ApplicationPortForwardingWizard(
+ application);
+ WizardDialog dialog = new ApplicationPortForwardingWizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
+ wizard);
+ dialog.setMinimumPageSize(700, 300);
+ dialog.create();
+ dialog.open();
+ }
+ });
}
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-30 19:57:55 UTC (rev 41547)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -12,28 +12,26 @@
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils;
+import org.jboss.tools.openshift.express.internal.ui.job.RetrieveApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.VerifySSHSessionJob;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
import com.openshift.client.IApplication;
-import com.openshift.client.OpenShiftSSHOperationException;
/**
* @author Xavier Coulon
*/
-public class ShowEnvironmentAction extends AbstractSSHAction {
+public class ShowEnvironmentAction extends AbstractAction {
public ShowEnvironmentAction() {
super(OpenShiftExpressUIMessages.SHOW_ENVIRONMENT_ACTION, true);
@@ -49,10 +47,10 @@
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (selection instanceof ITreeSelection && treeSelection.getFirstElement() instanceof IApplication) {
final IApplication application = (IApplication) treeSelection.getFirstElement();
- showEnvironmentProperties(application);
+ showEnvironmentPropertiesFor(application);
} else if (selection instanceof ITreeSelection && treeSelection.getFirstElement() instanceof IServer) {
final IServer server = (IServer) treeSelection.getFirstElement();
- showEnvironmentProperties(server);
+ showEnvironmentPropertiesFor(server);
}
}
@@ -64,40 +62,37 @@
*
* @param server
*/
- private void showEnvironmentProperties(final IServer server) {
- Job job = new Job("Identifying OpenShift Application from selected Server...") {
+ private void showEnvironmentPropertiesFor(final IServer server) {
+ final RetrieveApplicationJob job = new RetrieveApplicationJob(server);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- final IApplication application = ExpressServerUtils.getApplication(server);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- showEnvironmentProperties(application);
- }
- });
- return Status.OK_STATUS;
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ final IApplication application = job.getApplication();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ showEnvironmentPropertiesFor(application);
+ }
+ });
+ }
}
- };
+ });
job.setUser(true);
job.schedule();
}
- private void showEnvironmentProperties(final IApplication application) {
- Job job = new Job("Retrieving selected OpenShift Application's environment variables...") {
+ private void showEnvironmentPropertiesFor(final IApplication application) {
+ final VerifySSHSessionJob job = new VerifySSHSessionJob(application);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- verifyApplicationSSHSession(application);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- runAsync(application);
- }
- });
- return Status.OK_STATUS;
- } catch (OpenShiftSSHOperationException e) {
- return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ public void done(IJobChangeEvent event) {
+ if(event.getResult().isOK() && job.isValidSession()) {
+ showEnvironmentProperties(application);
}
}
- };
+ });
+
job.setUser(true);
job.schedule();
}
@@ -105,22 +100,27 @@
/**
* @param application
*/
- private void runAsync(final IApplication application) {
- try {
- if (!application.hasSSHSession()) {
- application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
+ private void showEnvironmentProperties(final IApplication application) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (!application.hasSSHSession()) {
+ application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
+ }
+ List<String> props = application.getEnvironmentProperties();
+ final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
+ console.clearConsole();
+ MessageConsoleStream stream = console.newMessageStream();
+ for (String prop : props) {
+ stream.println(prop);
+ }
+ ConsoleUtils.displayConsoleView(console);
+ } catch (Exception e) {
+ OpenShiftUIActivator.createErrorStatus("Failed to display remote environment variables", e);
+ }
}
- List<String> props = application.getEnvironmentProperties();
- final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
- console.clearConsole();
- MessageConsoleStream stream = console.newMessageStream();
- for (String prop : props) {
- stream.println(prop);
- }
- ConsoleUtils.displayConsoleView(console);
- } catch (Exception e) {
- OpenShiftUIActivator.createErrorStatus("Failed to display remote environment variables", e);
- }
+ });
}
/**
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+import com.openshift.client.IApplication;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class RetrieveApplicationJob extends Job {
+
+ private IApplication application = null;
+
+ private final IServer server;
+
+ public RetrieveApplicationJob(final IServer server) {
+ super("Identifying OpenShift Application from selected Server...");
+ this.server = server;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ this.application = ExpressServerUtils.getApplication(server);
+ if(application == null) {
+ return OpenShiftUIActivator.createErrorStatus("Failed to retrieve Application from the selected Server.\n" +
+ "Please verify that the associated OpenShift Application still exists.");
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return the application
+ */
+ public final IApplication getApplication() {
+ return application;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
+
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.openshift.client.IApplication;
+import com.openshift.client.OpenShiftSSHOperationException;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class VerifySSHSessionJob extends Job {
+
+ private final IApplication application;
+
+ private boolean validSession = false;
+
+ public VerifySSHSessionJob(final IApplication application) {
+ super("Verifying SSH session to retrieve Application's ports...");
+ this.application = application;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final boolean hasAlreadySSHSession = application.hasSSHSession();
+ if (!hasAlreadySSHSession) {
+ Logger.debug("Opening a new SSH Session for application '" + application.getName() + "'");
+ Session session;
+ session = OpenShiftSshSessionFactory.getInstance().createSession(
+ application);
+ application.setSSHSession(session);
+ }
+ // now, check if the session is valid (ie, not null and still
+ // connected)
+ this.validSession = application.hasSSHSession();
+ return Status.OK_STATUS;
+ } catch (OpenShiftSSHOperationException e) {
+ return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ }
+ }
+
+ /**
+ * @return the hasSession
+ */
+ public final boolean isValidSession() {
+ return validSession;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-05-30 19:57:55 UTC (rev 41547)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-05-30 20:06:22 UTC (rev 41548)
@@ -446,6 +446,7 @@
@Override
public UserDelegate setUser(UserDelegate user) {
+ UserDelegate oldValue = (UserDelegate) getProperty(USER);
return (UserDelegate) setProperty(USER, user);
}
12 years, 7 months
JBoss Tools SVN: r41547 - in branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/action and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-05-30 15:57:55 -0400 (Wed, 30 May 2012)
New Revision: 41547
Added:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
Log:
Fixed - JBIDE-12018
first time I open Port forwarding on an app it pops up the dialog and closes it again instantly
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-30 19:22:08 UTC (rev 41546)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-30 19:57:55 UTC (rev 41547)
@@ -331,7 +331,7 @@
@Override
protected void onPageActivated(DataBindingContext dbc) {
- final Job j = new Job("Retrieving application's forwardable ports...") {
+ final Job j = new Job("Loading application's forwardable ports...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
@@ -350,18 +350,11 @@
}
};
- getContainer().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- IStatus status = WizardUtils.runInWizard(j, getContainer(), getDataBindingContext());
- if(!status.isOK()) {
- getWizard().getContainer().getShell().close();
- }
- } catch(Exception e) {
- // ignore
- }
- }
- });
+ try {
+ WizardUtils.runInWizard(j, getContainer(), getDataBindingContext());
+ } catch (Exception e) {
+ Logger.error("Failed to load application's forwardable ports", e);
+ }
}
private void refreshViewerInput() {
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java 2012-05-30 19:22:08 UTC (rev 41546)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ApplicationPortForwardingAction.java 2012-05-30 19:57:55 UTC (rev 41547)
@@ -1,25 +1,22 @@
package org.jboss.tools.openshift.express.internal.ui.action;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingWizard;
import org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingWizardDialog;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.job.RetrieveApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.VerifySSHSessionJob;
import com.openshift.client.IApplication;
-import com.openshift.client.OpenShiftSSHOperationException;
-public class ApplicationPortForwardingAction extends AbstractSSHAction {
+public class ApplicationPortForwardingAction extends AbstractAction {
public ApplicationPortForwardingAction() {
super("Port forwarding...", DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT));
@@ -35,9 +32,9 @@
if (selection != null && selection instanceof ITreeSelection) {
Object sel = ((ITreeSelection) selection).getFirstElement();
if (sel instanceof IApplication) {
- openPortForwardingDialog((IApplication) sel);
+ openPortForwardingDialogFor((IApplication) sel);
} else if (sel instanceof IServer) {
- openPortForwardingDialog((IServer) sel);
+ openPortForwardingDialogFor((IServer) sel);
}
}
}
@@ -49,62 +46,53 @@
*
* @param server
*/
- private void openPortForwardingDialog(final IServer server) {
- Job job = new Job("Identifying OpenShift Application from selected Server...") {
+ private void openPortForwardingDialogFor(final IServer server) {
+ final RetrieveApplicationJob job = new RetrieveApplicationJob(server);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- final IApplication application = ExpressServerUtils.getApplication(server);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- openPortForwardingDialog(application);
- }
- });
- return Status.OK_STATUS;
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ final IApplication application = job.getApplication();
+ openPortForwardingDialogFor(application);
+ }
}
- };
+ });
job.setUser(true);
job.schedule();
}
- private void openPortForwardingDialog(final IApplication application) {
- Job job = new Job("Retrieving application's forwardable ports...") {
+ private void openPortForwardingDialogFor(final IApplication application) {
+ final VerifySSHSessionJob job = new VerifySSHSessionJob(application);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- verifyApplicationSSHSession(application);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- runAsync(application);
- }
- });
- return Status.OK_STATUS;
- } catch (OpenShiftSSHOperationException e) {
- return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK() && job.isValidSession()) {
+ openWizardDialog(application);
}
}
- };
+ });
+
job.setUser(true);
job.schedule();
}
/**
+ * Opens the Port Forwarding dialog for good...
+ *
* @param application
*/
- private void runAsync(final IApplication application) {
- try {
- ApplicationPortForwardingWizard wizard = new ApplicationPortForwardingWizard(
- application);
- WizardDialog dialog = new ApplicationPortForwardingWizardDialog(Display.getCurrent()
- .getActiveShell(),
- wizard);
- dialog.setMinimumPageSize(700, 300);
- dialog.create();
- dialog.open();
- } catch (Exception e) {
- Logger.error(
- "Failed to perform 'port-forwarding' for application '" + application.getName()
- + "'", e);
- }
+ private void openWizardDialog(final IApplication application) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ApplicationPortForwardingWizard wizard = new ApplicationPortForwardingWizard(
+ application);
+ WizardDialog dialog = new ApplicationPortForwardingWizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
+ wizard);
+ dialog.setMinimumPageSize(700, 300);
+ dialog.create();
+ dialog.open();
+ }
+ });
}
-
}
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-30 19:22:08 UTC (rev 41546)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ShowEnvironmentAction.java 2012-05-30 19:57:55 UTC (rev 41547)
@@ -12,28 +12,26 @@
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils;
+import org.jboss.tools.openshift.express.internal.ui.job.RetrieveApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.VerifySSHSessionJob;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
import com.openshift.client.IApplication;
-import com.openshift.client.OpenShiftSSHOperationException;
/**
* @author Xavier Coulon
*/
-public class ShowEnvironmentAction extends AbstractSSHAction {
+public class ShowEnvironmentAction extends AbstractAction {
public ShowEnvironmentAction() {
super(OpenShiftExpressUIMessages.SHOW_ENVIRONMENT_ACTION, true);
@@ -49,10 +47,10 @@
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (selection instanceof ITreeSelection && treeSelection.getFirstElement() instanceof IApplication) {
final IApplication application = (IApplication) treeSelection.getFirstElement();
- showEnvironmentProperties(application);
+ showEnvironmentPropertiesFor(application);
} else if (selection instanceof ITreeSelection && treeSelection.getFirstElement() instanceof IServer) {
final IServer server = (IServer) treeSelection.getFirstElement();
- showEnvironmentProperties(server);
+ showEnvironmentPropertiesFor(server);
}
}
@@ -64,40 +62,37 @@
*
* @param server
*/
- private void showEnvironmentProperties(final IServer server) {
- Job job = new Job("Identifying OpenShift Application from selected Server...") {
+ private void showEnvironmentPropertiesFor(final IServer server) {
+ final RetrieveApplicationJob job = new RetrieveApplicationJob(server);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- final IApplication application = ExpressServerUtils.getApplication(server);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- showEnvironmentProperties(application);
- }
- });
- return Status.OK_STATUS;
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ final IApplication application = job.getApplication();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ showEnvironmentPropertiesFor(application);
+ }
+ });
+ }
}
- };
+ });
job.setUser(true);
job.schedule();
}
- private void showEnvironmentProperties(final IApplication application) {
- Job job = new Job("Retrieving selected OpenShift Application's environment variables...") {
+ private void showEnvironmentPropertiesFor(final IApplication application) {
+ final VerifySSHSessionJob job = new VerifySSHSessionJob(application);
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- verifyApplicationSSHSession(application);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- runAsync(application);
- }
- });
- return Status.OK_STATUS;
- } catch (OpenShiftSSHOperationException e) {
- return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ public void done(IJobChangeEvent event) {
+ if(event.getResult().isOK() && job.isValidSession()) {
+ showEnvironmentProperties(application);
}
}
- };
+ });
+
job.setUser(true);
job.schedule();
}
@@ -105,22 +100,27 @@
/**
* @param application
*/
- private void runAsync(final IApplication application) {
- try {
- if (!application.hasSSHSession()) {
- application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
+ private void showEnvironmentProperties(final IApplication application) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (!application.hasSSHSession()) {
+ application.setSSHSession(OpenShiftSshSessionFactory.getInstance().createSession(application));
+ }
+ List<String> props = application.getEnvironmentProperties();
+ final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
+ console.clearConsole();
+ MessageConsoleStream stream = console.newMessageStream();
+ for (String prop : props) {
+ stream.println(prop);
+ }
+ ConsoleUtils.displayConsoleView(console);
+ } catch (Exception e) {
+ OpenShiftUIActivator.createErrorStatus("Failed to display remote environment variables", e);
+ }
}
- List<String> props = application.getEnvironmentProperties();
- final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName(application));
- console.clearConsole();
- MessageConsoleStream stream = console.newMessageStream();
- for (String prop : props) {
- stream.println(prop);
- }
- ConsoleUtils.displayConsoleView(console);
- } catch (Exception e) {
- OpenShiftUIActivator.createErrorStatus("Failed to display remote environment variables", e);
- }
+ });
}
/**
Added: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java (rev 0)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java 2012-05-30 19:57:55 UTC (rev 41547)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+import com.openshift.client.IApplication;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class RetrieveApplicationJob extends Job {
+
+ private IApplication application = null;
+
+ private final IServer server;
+
+ public RetrieveApplicationJob(final IServer server) {
+ super("Identifying OpenShift Application from selected Server...");
+ this.server = server;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ this.application = ExpressServerUtils.getApplication(server);
+ if(application == null) {
+ return OpenShiftUIActivator.createErrorStatus("Failed to retrieve Application from the selected Server.\n" +
+ "Please verify that the associated OpenShift Application still exists.");
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return the application
+ */
+ public final IApplication getApplication() {
+ return application;
+ }
+
+}
Property changes on: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/RetrieveApplicationJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java (rev 0)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java 2012-05-30 19:57:55 UTC (rev 41547)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
+
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.openshift.client.IApplication;
+import com.openshift.client.OpenShiftSSHOperationException;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class VerifySSHSessionJob extends Job {
+
+ private final IApplication application;
+
+ private boolean validSession = false;
+
+ public VerifySSHSessionJob(final IApplication application) {
+ super("Verifying SSH session to retrieve Application's ports...");
+ this.application = application;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final boolean hasAlreadySSHSession = application.hasSSHSession();
+ if (!hasAlreadySSHSession) {
+ Logger.debug("Opening a new SSH Session for application '" + application.getName() + "'");
+ Session session;
+ session = OpenShiftSshSessionFactory.getInstance().createSession(
+ application);
+ application.setSSHSession(session);
+ }
+ // now, check if the session is valid (ie, not null and still
+ // connected)
+ this.validSession = application.hasSSHSession();
+ return Status.OK_STATUS;
+ } catch (OpenShiftSSHOperationException e) {
+ return OpenShiftUIActivator.createErrorStatus(e.getMessage(), e.getCause());
+ }
+ }
+
+ /**
+ * @return the hasSession
+ */
+ public final boolean isValidSession() {
+ return validSession;
+ }
+
+}
Property changes on: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/VerifySSHSessionJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 7 months
JBoss Tools SVN: r41546 - trunk/build/aggregate.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-05-30 15:22:08 -0400 (Wed, 30 May 2012)
New Revision: 41546
Modified:
trunk/build/aggregate/pom.xml
Log:
aggregate site builder in trunk should use 3.4.0.M1-SNAPSHOT not 3.3.0.Final-SNAPSHOT as parent pom version
Modified: trunk/build/aggregate/pom.xml
===================================================================
--- trunk/build/aggregate/pom.xml 2012-05-30 18:59:12 UTC (rev 41545)
+++ trunk/build/aggregate/pom.xml 2012-05-30 19:22:08 UTC (rev 41546)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jboss.tools</groupId>
<artifactId>parent</artifactId>
- <version>3.3.0.Final-SNAPSHOT</version>
+ <version>3.4.0.M1-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>org.jboss.tools</groupId>
12 years, 7 months