JBoss Tools SVN: r29699 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 21:13:14 -0500 (Thu, 10 Mar 2011)
New Revision: 29699
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java
Log:
add wrapping to the text viewer
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java 2011-03-11 01:06:14 UTC (rev 29698)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java 2011-03-11 02:13:14 UTC (rev 29699)
@@ -44,7 +44,7 @@
}
protected StyledText createTextWidget(Composite parent, int styles) {
- ConsoleText styledText= new ConsoleText(parent, styles);
+ ConsoleText styledText= new ConsoleText(parent, styles | SWT.WRAP);
styledText.setLeftMargin(Math.max(styledText.getLeftMargin(), 2));
styledText.addKeyListener(new ConsoleKeyListener());
return styledText;
13 years, 8 months
JBoss Tools SVN: r29698 - in trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-03-10 20:06:14 -0500 (Thu, 10 Mar 2011)
New Revision: 29698
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/MultipleHyperlinkPresenter.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/MultipleHyperlinkPresenterManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java
Log:
https://issues.jboss.org/browse/JBIDE-7971
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -23,11 +23,13 @@
private IRegion region;
private List<IBean> beans;
private ITextViewer viewer;
+ private int previousIndex;
- public AlternativeInjectedPointListHyperlink(IRegion region, List<IBean> beans, ITextViewer viewer, IDocument document){
+ public AlternativeInjectedPointListHyperlink(IRegion region, List<IBean> beans, ITextViewer viewer, IDocument document, int previousIndex){
this.beans = beans;
this.region = region;
this.viewer = viewer;
+ this.previousIndex = previousIndex;
setDocument(document);
}
@@ -53,7 +55,7 @@
if(hyperlinks.length == 1){
((InjectedPointHyperlink)hyperlinks[0]).doHyperlink(region);
}else{
- MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks);
+ MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks, previousIndex);
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -112,13 +112,13 @@
Set<IObserverMethod> observerMethods = cdiProject.resolveObserverMethods(injectionPoint);
if(observerMethods.size() > 0)
- hyperlinks.add(new ObserverMethodListHyperlink(textViewer, region, observerMethods, document));
+ hyperlinks.add(new ObserverMethodListHyperlink(textViewer, region, observerMethods, document, hyperlinks.size()));
} else if(param != null) {
Set<IInjectionPoint> events = cdiProject.findObservedEvents(param);
if(events.size() > 0)
- hyperlinks.add(new EventListHyperlink(textViewer, region, events, document));
+ hyperlinks.add(new EventListHyperlink(textViewer, region, events, document, hyperlinks.size()));
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -24,11 +24,13 @@
private ITextViewer viewer;
private Set<IInjectionPoint> events;
private IRegion region;
+ private int previousIndex;
- public EventListHyperlink(ITextViewer viewer, IRegion region, Set<IInjectionPoint> events, IDocument document){
+ public EventListHyperlink(ITextViewer viewer, IRegion region, Set<IInjectionPoint> events, IDocument document, int previousIndex){
this.viewer = viewer;
this.events = events;
this.region = region;
+ this.previousIndex = previousIndex;
setDocument(document);
}
@@ -53,7 +55,7 @@
if(hyperlinks.length == 1){
((EventHyperlink)hyperlinks[0]).doHyperlink(region);
}else{
- MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks);
+ MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks, previousIndex);
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -139,7 +139,7 @@
if(resultBeanList.size() > 0){
hyperlinks.add(new InjectedPointHyperlink(region, resultBeanList.get(0), document, true));
if(alternativeBeanList.size() > 1)
- hyperlinks.add(new AlternativeInjectedPointListHyperlink(region, alternativeBeanList, viewer, document));
+ hyperlinks.add(new AlternativeInjectedPointListHyperlink(region, alternativeBeanList, viewer, document, hyperlinks.size()));
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/MultipleHyperlinkPresenterManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/MultipleHyperlinkPresenterManager.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/MultipleHyperlinkPresenterManager.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -12,23 +12,23 @@
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.cdi.text.ext.hyperlink.xpl.MultipleHyperlinkPresenter;
public class MultipleHyperlinkPresenterManager {
private static MultipleHyperlinkPresenter mhp = new MultipleHyperlinkPresenter(new RGB(0, 0, 255));
private static boolean installed = false;
private static MyPartListener listener = new MyPartListener();
- public static void installAndShow(ITextViewer viewer, IHyperlink[] hyperlinks){
+ public static void installAndShow(ITextViewer viewer, IHyperlink[] hyperlinks, int previousIndex){
if(installed)
uninstall();
mhp.install(viewer);
- mhp.showHyperlinks(hyperlinks);
+ mhp.showHyperlinks(hyperlinks, previousIndex);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(listener);
installed = true;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2011-03-11 00:50:03 UTC (rev 29697)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -24,11 +24,13 @@
private ITextViewer viewer;
private Set<IObserverMethod> observerMethods;
private IRegion region;
+ private int previousIndex;
- public ObserverMethodListHyperlink(ITextViewer viewer, IRegion region, Set<IObserverMethod> observerMethods, IDocument document){
+ public ObserverMethodListHyperlink(ITextViewer viewer, IRegion region, Set<IObserverMethod> observerMethods, IDocument document, int previousIndex){
this.viewer = viewer;
this.observerMethods = observerMethods;
this.region = region;
+ this.previousIndex = previousIndex;
setDocument(document);
}
@@ -53,7 +55,7 @@
if(hyperlinks.length == 1){
((ObserverMethodHyperlink)hyperlinks[0]).doHyperlink(region);
}else{
- MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks);
+ MultipleHyperlinkPresenterManager.installAndShow(viewer, hyperlinks, previousIndex);
}
}
Added: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/MultipleHyperlinkPresenter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/MultipleHyperlinkPresenter.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/MultipleHyperlinkPresenter.java 2011-03-11 01:06:14 UTC (rev 29698)
@@ -0,0 +1,812 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Exadel, Inc.
+ * Red Hat, Inc.
+ *******************************************************************************/
+package org.jboss.tools.cdi.text.ext.hyperlink.xpl;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.AbstractInformationControl;
+import org.eclipse.jface.text.AbstractInformationControlManager;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IInformationControlExtension2;
+import org.eclipse.jface.text.IInformationControlExtension3;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension;
+import org.eclipse.jface.text.ITextHoverExtension2;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.IWidgetTokenKeeper;
+import org.eclipse.jface.text.IWidgetTokenKeeperExtension;
+import org.eclipse.jface.text.IWidgetTokenOwner;
+import org.eclipse.jface.text.IWidgetTokenOwnerExtension;
+import org.eclipse.jface.text.JFaceTextUtil;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.util.Geometry;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
+
+ private static final boolean IS_WIN32= "win32".equals(SWT.getPlatform()); //$NON-NLS-1$
+
+ /**
+ * An information control capable of showing a list of hyperlinks. The hyperlinks can be opened.
+ */
+ private static class LinkListInformationControl extends AbstractInformationControl implements IInformationControlExtension2 {
+
+ private static final class LinkContentProvider implements IStructuredContentProvider {
+
+ /*
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return (Object[]) inputElement;
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ private static final class LinkLabelProvider extends ColumnLabelProvider {
+ /*
+ * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ IHyperlink link= (IHyperlink)element;
+ String text= link.getHyperlinkText();
+ if (text != null)
+ return text;
+ return "Unknown Link";
+ }
+ }
+
+ private final MultipleHyperlinkHoverManager fManager;
+
+ private IHyperlink[] fInput;
+ private Composite fParent;
+ private Table fTable;
+
+ private Color fForegroundColor;
+ private Color fBackgroundColor;
+
+
+ /**
+ * Creates a link list information control with the given shell as parent.
+ *
+ * @param parentShell the parent shell
+ * @param manager the hover manager
+ * @param foregroundColor the foreground color, must not be disposed
+ * @param backgroundColor the background color, must not be disposed
+ */
+ public LinkListInformationControl(Shell parentShell, MultipleHyperlinkHoverManager manager, Color foregroundColor, Color backgroundColor) {
+ super(parentShell, false);
+ fManager= manager;
+ fForegroundColor= foregroundColor;
+ fBackgroundColor= backgroundColor;
+ create();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
+ */
+ public void setInformation(String information) {
+ //replaced by IInformationControlExtension2#setInput(java.lang.Object)
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
+ */
+ public void setInput(Object input) {
+ fInput= (IHyperlink[]) input;
+ deferredCreateContent(fParent);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createContent(Composite parent) {
+ fParent= parent;
+ if (IS_WIN32) {
+ GridLayout layout= new GridLayout();
+ layout.marginWidth= 0;
+ layout.marginRight= 4;
+ fParent.setLayout(layout);
+ }
+ fParent.setForeground(fForegroundColor);
+ fParent.setBackground(fBackgroundColor);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControl#computeSizeHint()
+ */
+ public Point computeSizeHint() {
+ Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+
+ Point constraints= getSizeConstraints();
+ if (constraints == null)
+ return preferedSize;
+
+ if (fTable.getVerticalBar() == null || fTable.getHorizontalBar() == null)
+ return Geometry.min(constraints, preferedSize);
+
+ int scrollBarWidth= fTable.getVerticalBar().getSize().x;
+ int scrollBarHeight= fTable.getHorizontalBar().getSize().y;
+
+ int width;
+ if (preferedSize.y - scrollBarHeight <= constraints.y) {
+ width= preferedSize.x - scrollBarWidth;
+ fTable.getVerticalBar().setVisible(false);
+ } else {
+ width= Math.min(preferedSize.x, constraints.x);
+ }
+
+ int height;
+ if (preferedSize.x - scrollBarWidth <= constraints.x) {
+ height= preferedSize.y - scrollBarHeight;
+ fTable.getHorizontalBar().setVisible(false);
+ } else {
+ height= Math.min(preferedSize.y, constraints.y);
+ }
+
+ return new Point(width, height);
+ }
+
+ private void deferredCreateContent(Composite parent) {
+ fTable= new Table(parent, SWT.SINGLE | SWT.FULL_SELECTION);
+ fTable.setLinesVisible(false);
+ fTable.setHeaderVisible(false);
+ fTable.setForeground(fForegroundColor);
+ fTable.setBackground(fBackgroundColor);
+ fTable.setFont(JFaceResources.getDialogFont());
+
+ if (IS_WIN32) {
+ GridData data= new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
+ fTable.setLayoutData(data);
+ }
+
+ final TableViewer viewer= new TableViewer(fTable);
+ viewer.setContentProvider(new LinkContentProvider());
+ viewer.setLabelProvider(new LinkLabelProvider());
+ viewer.setInput(fInput);
+ fTable.setSelection(0);
+
+ registerTableListeners();
+
+ getShell().addShellListener(new ShellAdapter() {
+
+ /*
+ * @see org.eclipse.swt.events.ShellAdapter#shellActivated(org.eclipse.swt.events.ShellEvent)
+ */
+ public void shellActivated(ShellEvent e) {
+ if (viewer.getTable().getSelectionCount() == 0) {
+ viewer.getTable().setSelection(0);
+ }
+
+ viewer.getTable().setFocus();
+ }
+ });
+ }
+
+ private void registerTableListeners() {
+
+ fTable.addMouseMoveListener(new MouseMoveListener() {
+ TableItem fLastItem= null;
+
+ public void mouseMove(MouseEvent e) {
+ if (fTable.equals(e.getSource())) {
+ Object o= fTable.getItem(new Point(e.x, e.y));
+ if (o instanceof TableItem) {
+ TableItem item= (TableItem) o;
+ if (!o.equals(fLastItem)) {
+ fLastItem= (TableItem) o;
+ fTable.setSelection(new TableItem[] { fLastItem });
+ } else if (e.y < fTable.getItemHeight() / 4) {
+ // Scroll up
+ int index= fTable.indexOf(item);
+ if (index > 0) {
+ fLastItem= fTable.getItem(index - 1);
+ fTable.setSelection(new TableItem[] { fLastItem });
+ }
+ } else if (e.y > fTable.getBounds().height - fTable.getItemHeight() / 4) {
+ // Scroll down
+ int index= fTable.indexOf(item);
+ if (index < fTable.getItemCount() - 1) {
+ fLastItem= fTable.getItem(index + 1);
+ fTable.setSelection(new TableItem[] { fLastItem });
+ }
+ }
+ }
+ }
+ }
+ });
+
+ fTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ openSelectedLink();
+ }
+ });
+
+ fTable.addMouseListener(new MouseAdapter() {
+ public void mouseUp(MouseEvent e) {
+ if (fTable.getSelectionCount() < 1)
+ return;
+
+ if (e.button != 1)
+ return;
+
+ if (fTable.equals(e.getSource())) {
+ Object o= fTable.getItem(new Point(e.x, e.y));
+ TableItem selection= fTable.getSelection()[0];
+ if (selection.equals(o))
+ openSelectedLink();
+ }
+ }
+ });
+
+ fTable.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == 0x0D) // return
+ openSelectedLink();
+ }
+ });
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IInformationControlExtension#hasContents()
+ */
+ public boolean hasContents() {
+ return true;
+ }
+
+ /**
+ * Opens the currently selected link.
+ */
+ private void openSelectedLink() {
+ if (fTable.getSelectionCount() < 1)
+ return;
+
+ TableItem selection= fTable.getSelection()[0];
+ IHyperlink link= (IHyperlink)selection.getData();
+ fManager.hideInformationControl();
+ fManager.setCaret();
+ link.open();
+ }
+ }
+
+ private class MultipleHyperlinkHover implements ITextHover, ITextHoverExtension, ITextHoverExtension2 {
+
+ /**
+ * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ * @deprecated As of 3.4, replaced by
+ * {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)}
+ */
+ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+ return fSubjectRegion;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
+ return fHyperlinks;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
+ */
+ public IInformationControlCreator getHoverControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ Color foregroundColor= fTextViewer.getTextWidget().getForeground();
+ Color backgroundColor= fTextViewer.getTextWidget().getBackground();
+ return new LinkListInformationControl(parent, fManager, foregroundColor, backgroundColor);
+ }
+ };
+ }
+ }
+
+ private static class MultipleHyperlinkHoverManager extends AbstractInformationControlManager implements IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
+
+ private class Closer implements IInformationControlCloser, Listener, KeyListener, MouseListener {
+
+ private Control fSubjectControl;
+ private Display fDisplay;
+ private IInformationControl fControl;
+ private Rectangle fSubjectArea;
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setInformationControl(org.eclipse.jface.text.IInformationControl)
+ */
+ public void setInformationControl(IInformationControl control) {
+ fControl= control;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setSubjectControl(org.eclipse.swt.widgets.Control)
+ */
+ public void setSubjectControl(Control subject) {
+ fSubjectControl= subject;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#start(org.eclipse.swt.graphics.Rectangle)
+ */
+ public void start(Rectangle subjectArea) {
+ fSubjectArea= subjectArea;
+
+ fDisplay= fSubjectControl.getDisplay();
+ if (!fDisplay.isDisposed()) {
+ fDisplay.addFilter(SWT.FocusOut, this);
+ fDisplay.addFilter(SWT.MouseMove, this);
+ fTextViewer.getTextWidget().addKeyListener(this);
+ fTextViewer.getTextWidget().addMouseListener(this);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#stop()
+ */
+ public void stop() {
+ if (fDisplay != null && !fDisplay.isDisposed()) {
+ fDisplay.removeFilter(SWT.FocusOut, this);
+ fDisplay.removeFilter(SWT.MouseMove, this);
+ fTextViewer.getTextWidget().removeKeyListener(this);
+ fTextViewer.getTextWidget().removeMouseListener(this);
+ }
+
+ fSubjectArea= null;
+ }
+
+ /*
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
+ */
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.FocusOut:
+ if (!fControl.isFocusControl())
+ disposeInformationControl();
+ break;
+ case SWT.MouseMove:
+ handleMouseMove(event);
+ break;
+ }
+ }
+
+ /**
+ * Handle mouse movement events.
+ *
+ * @param event the event
+ */
+ private void handleMouseMove(Event event) {
+ if (!(event.widget instanceof Control))
+ return;
+
+ if (fControl.isFocusControl())
+ return;
+
+ Control eventControl= (Control) event.widget;
+
+ //transform coordinates to subject control:
+ Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y);
+
+ if (fSubjectArea.contains(mouseLoc))
+ return;
+
+ if (inKeepUpZone(mouseLoc.x, mouseLoc.y, ((IInformationControlExtension3) fControl).getBounds()))
+ return;
+
+ hideInformationControl();
+ }
+
+ /**
+ * Tests whether a given mouse location is within the keep-up zone.
+ * The hover should not be hidden as long as the mouse stays inside this zone.
+ *
+ * @param x the x coordinate, relative to the <em>subject control</em>
+ * @param y the y coordinate, relative to the <em>subject control</em>
+ * @param controlBounds the bounds of the current control
+ *
+ * @return <code>true</code> iff the mouse event occurred in the keep-up zone
+ */
+ private boolean inKeepUpZone(int x, int y, Rectangle controlBounds) {
+ // +-----------+
+ // |subjectArea|
+ // +-----------+
+ // |also keepUp|
+ // ++-----------+-------+
+ // | totalBounds |
+ // +--------------------+
+ if (fSubjectArea.contains(x, y))
+ return true;
+
+ Rectangle iControlBounds= fSubjectControl.getDisplay().map(null, fSubjectControl, controlBounds);
+ Rectangle totalBounds= Geometry.copy(iControlBounds);
+ if (totalBounds.contains(x, y))
+ return true;
+
+ int keepUpY= fSubjectArea.y + fSubjectArea.height;
+ Rectangle alsoKeepUp= new Rectangle(fSubjectArea.x, keepUpY, fSubjectArea.width, totalBounds.y - keepUpY);
+ return alsoKeepUp.contains(x, y);
+ }
+
+ /*
+ * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyPressed(KeyEvent e) {
+ }
+
+ /*
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyReleased(KeyEvent e) {
+ hideInformationControl();
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
+ * @since 3.5
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
+ * @since 3.5
+ */
+ public void mouseDown(MouseEvent e) {
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
+ * @since 3.5
+ */
+ public void mouseUp(MouseEvent e) {
+ hideInformationControl();
+ }
+
+ }
+
+ /**
+ * Priority of the hover managed by this manager.
+ * Default value: One higher then for the hovers
+ * managed by TextViewerHoverManager.
+ */
+ private static final int WIDGET_TOKEN_PRIORITY= 1;
+
+ private final MultipleHyperlinkHover fHover;
+ private final ITextViewer fTextViewer;
+ private final MultipleHyperlinkPresenter fHyperlinkPresenter;
+ private Closer fCloser;
+ private boolean fIsControlVisible;
+
+
+ /**
+ * Create a new MultipleHyperlinkHoverManager. The MHHM can show and hide
+ * the given MultipleHyperlinkHover inside the given ITextViewer.
+ *
+ * @param hover the hover to manage
+ * @param viewer the viewer to show the hover in
+ * @param hyperlinkPresenter the hyperlink presenter using this manager to present hyperlinks
+ */
+ public MultipleHyperlinkHoverManager(MultipleHyperlinkHover hover, ITextViewer viewer, MultipleHyperlinkPresenter hyperlinkPresenter) {
+ super(hover.getHoverControlCreator());
+
+ fHover= hover;
+ fTextViewer= viewer;
+ fHyperlinkPresenter= hyperlinkPresenter;
+
+ fCloser= new Closer();
+ setCloser(fCloser);
+ fIsControlVisible= false;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformation()
+ */
+ protected void computeInformation() {
+ IRegion region= fHover.getHoverRegion(fTextViewer, -1);
+ if (region == null) {
+ setInformation(null, null);
+ return;
+ }
+
+ Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer);
+ if (area == null || area.isEmpty()) {
+ setInformation(null, null);
+ return;
+ }
+
+ Object information= fHover.getHoverInfo2(fTextViewer, region);
+ setCustomInformationControlCreator(fHover.getHoverControlCreator());
+ setInformation(information, area);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformationControlLocation(org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.Point)
+ */
+ protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) {
+ Point result= super.computeInformationControlLocation(subjectArea, controlSize);
+
+ Point cursorLocation= fTextViewer.getTextWidget().getDisplay().getCursorLocation();
+ if (cursorLocation.x <= result.x + controlSize.x)
+ return result;
+
+ result.x= cursorLocation.x + 20 - controlSize.x;
+ return result;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager#showInformationControl(org.eclipse.swt.graphics.Rectangle)
+ */
+ protected void showInformationControl(Rectangle subjectArea) {
+ int offset = fTextViewer.getTextWidget().getLineHeight()*(index+1);
+ Rectangle bounds = ((IInformationControlExtension3)fInformationControl).getBounds();
+ Point location = new Point(bounds.x, bounds.y+offset);
+ fInformationControl.setLocation(location);
+ if (fTextViewer instanceof IWidgetTokenOwnerExtension) {
+ if (((IWidgetTokenOwnerExtension) fTextViewer).requestWidgetToken(this, WIDGET_TOKEN_PRIORITY))
+ super.showInformationControl(subjectArea);
+ } else if (fTextViewer instanceof IWidgetTokenOwner) {
+ if (((IWidgetTokenOwner) fTextViewer).requestWidgetToken(this))
+ super.showInformationControl(subjectArea);
+ } else {
+ super.showInformationControl(subjectArea);
+ }
+
+ fIsControlVisible= true;
+ }
+
+ /**
+ * Sets the caret where hyperlinking got initiated.
+ *
+ * @since 3.5
+ */
+ private void setCaret() {
+ fHyperlinkPresenter.setCaret();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
+ */
+ protected void hideInformationControl() {
+ super.hideInformationControl();
+
+ if (fTextViewer instanceof IWidgetTokenOwner) {
+ ((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this);
+ }
+
+ fIsControlVisible= false;
+ fHyperlinkPresenter.hideHyperlinks();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractInformationControlManager#disposeInformationControl()
+ */
+ public void disposeInformationControl() {
+ super.disposeInformationControl();
+
+ if (fTextViewer instanceof IWidgetTokenOwner) {
+ ((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this);
+ }
+
+ fIsControlVisible= false;
+ fHyperlinkPresenter.hideHyperlinks();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IWidgetTokenKeeper#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner)
+ */
+ public boolean requestWidgetToken(IWidgetTokenOwner owner) {
+ hideInformationControl();
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner, int)
+ */
+ public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority) {
+ if (priority < WIDGET_TOKEN_PRIORITY)
+ return false;
+
+ hideInformationControl();
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#setFocus(org.eclipse.jface.text.IWidgetTokenOwner)
+ */
+ public boolean setFocus(IWidgetTokenOwner owner) {
+ return false;
+ }
+
+ /**
+ * Returns <code>true</code> if the information control managed by
+ * this manager is visible, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if information control is visible
+ */
+ public boolean isInformationControlVisible() {
+ return fIsControlVisible;
+ }
+ }
+
+ private ITextViewer fTextViewer;
+
+ private IHyperlink[] fHyperlinks;
+ private Region fSubjectRegion;
+ private MultipleHyperlinkHoverManager fManager;
+
+ /**
+ * The offset in the text viewer where hyperlinking got initiated.
+ * @since 3.5
+ */
+ private int fCursorOffset;
+
+ /**
+ * Creates a new multiple hyperlink presenter which uses
+ * {@link #HYPERLINK_COLOR} to read the color from the given preference store.
+ *
+ * @param store the preference store
+ */
+ public MultipleHyperlinkPresenter(IPreferenceStore store) {
+ super(store);
+ }
+
+ /**
+ * Creates a new multiple hyperlink presenter.
+ *
+ * @param color the hyperlink color, to be disposed by the caller
+ */
+ public MultipleHyperlinkPresenter(RGB color) {
+ super(color);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#install(org.eclipse.jface.text.ITextViewer)
+ */
+ public void install(ITextViewer viewer) {
+ super.install(viewer);
+ fTextViewer= viewer;
+
+ fManager= new MultipleHyperlinkHoverManager(new MultipleHyperlinkHover(), fTextViewer, this);
+ fManager.install(viewer.getTextWidget());
+ fManager.setSizeConstraints(100, 12, false, true);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#uninstall()
+ */
+ public void uninstall() {
+ super.uninstall();
+
+ if (fTextViewer != null) {
+ fManager.dispose();
+
+ fTextViewer= null;
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canShowMultipleHyperlinks()
+ */
+ public boolean canShowMultipleHyperlinks() {
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canHideHyperlinks()
+ */
+ public boolean canHideHyperlinks() {
+ return !fManager.isInformationControlVisible();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#hideHyperlinks()
+ */
+ public void hideHyperlinks() {
+ super.hideHyperlinks();
+ fHyperlinks= null;
+ }
+
+ private static int index=0;
+
+ /*
+ * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#showHyperlinks(org.eclipse.jface.text.hyperlink.IHyperlink[])
+ */
+ public void showHyperlinks(IHyperlink[] hyperlinks, int index) {
+ super.showHyperlinks(new IHyperlink[] { hyperlinks[0] });
+
+ this.index = index;
+
+ fSubjectRegion= null;
+ fHyperlinks= hyperlinks;
+
+ if (hyperlinks.length == 1)
+ return;
+
+ int start= hyperlinks[0].getHyperlinkRegion().getOffset();
+ int end= start + hyperlinks[0].getHyperlinkRegion().getLength();
+
+ for (int i= 1; i < hyperlinks.length; i++) {
+ int hstart= hyperlinks[i].getHyperlinkRegion().getOffset();
+ int hend= hstart + hyperlinks[i].getHyperlinkRegion().getLength();
+
+ start= Math.min(start, hstart);
+ end= Math.max(end, hend);
+ }
+
+ fSubjectRegion= new Region(start, end - start);
+ fCursorOffset= JFaceTextUtil.getOffsetForCursorLocation(fTextViewer);
+
+ fManager.showInformation();
+ }
+
+ /**
+ * Sets the caret where hyperlinking got initiated.
+ *
+ * @since 3.5
+ */
+ private void setCaret() {
+ Point selectedRange= fTextViewer.getSelectedRange();
+ if (fCursorOffset != -1 && !(fSubjectRegion.getOffset() <= selectedRange.x && selectedRange.x + selectedRange.y <= fSubjectRegion.getOffset() + fSubjectRegion.getLength()))
+ fTextViewer.setSelectedRange(fCursorOffset, 0);
+ }
+
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/xpl/MultipleHyperlinkPresenter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 8 months
JBoss Tools SVN: r29697 - in trunk/jsf/docs/jsf_tools_ref_guide/en-US: images/jsf_support and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-03-10 19:50:03 -0500 (Thu, 10 Mar 2011)
New Revision: 29697
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_11.png
trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_2.png
trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_3.png
trunk/jsf/docs/jsf_tools_ref_guide/en-US/introduction.xml
trunk/jsf/docs/jsf_tools_ref_guide/en-US/jsf_support.xml
Log:
"General editing and screenshot updates"
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_11.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_2.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_3.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/introduction.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en-US/introduction.xml 2011-03-11 00:13:55 UTC (rev 29696)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en-US/introduction.xml 2011-03-11 00:50:03 UTC (rev 29697)
@@ -102,7 +102,7 @@
</section>
<section>
<title>Other relevant resources on the topic</title>
- <para>All JBoss Developer Studio/JBoss Tools release documentation you can find at <ulink url="http://docs.jboss.org/tools/">http://docs.jboss.org/tools</ulink> in the corresponding release directory.</para>
- <para>The latest documentation builds are available at <ulink url="http://download.jboss.org/jbosstools/nightly-docs/">http://download.jboss.org/jbosstools/nightly-docs</ulink>.</para>
+ <para>All JBoss Developer Studio and JBoss Tools release documentation can be found on the <ulink url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/index.html">RedHat Documentation</ulink> website. </para>
+ <para>Nightly documentation builds are available at <ulink url="http://download.jboss.org/jbosstools/nightly-docs/">http://download.jboss.org/jbosstools/nightly-docs</ulink>.</para>
</section>
</chapter>
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/jsf_support.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en-US/jsf_support.xml 2011-03-11 00:13:55 UTC (rev 29696)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en-US/jsf_support.xml 2011-03-11 00:50:03 UTC (rev 29697)
@@ -14,10 +14,10 @@
<title>JavaServer Faces Support</title>
<para>
- We don't lock you into any one <productname>JavaServer Faces</productname> implementation. You can always specify the desired <productname>JavaServer Faces</productname> implementation while creating a new JSF project (see <xref linkend="new_jsf_project"/>), adding JSF capability to any existing Eclipse project (see <xref linkend="add_jsf_capability"/>) or importing existing JSF projects (see <xref linkend="ImportingExsJSFProjWithAnyStr74447"/>).
+ JSF Tools does not lock you into any one <property>JavaServer Faces</property> implementation. You can always specify the desired <property>JavaServer Faces</property> implementation while creating a new JSF project (see <xref linkend="new_jsf_project"/>), adding JSF capability to any existing Eclipse project (see <xref linkend="add_jsf_capability"/>), or importing existing JSF projects (see <xref linkend="ImportingExsJSFProjWithAnyStr74447"/>).
</para>
<para>
- At this point the special wizard will prompt you to specify an appropriate JSF environment. It may be JSF 1.1.02 RI, or JSF 1.2 which integrates a number of new features and changes. The wizard also lets you select JSF implementation with a component orientation such as JSF 1.2 with Facelets or MyFaces 1.1.4.
+ At this point the special wizard will prompt you to specify an appropriate JSF environment. It may be <property>JSF 1.1.02 RI</property>, or <property>JSF 1.2</property> which integrates a number of new features and changes. The wizard also lets you select JSF implementation with a component orientation such as <property>JSF 1.2</property> with <property>Facelets</property> or <property>MyFaces 1.1.4</property>.
</para>
<figure>
@@ -30,7 +30,7 @@
</figure>
<para>
- After specifying an appropriate JSF environment all the required libraries associated with the selected version will be added to your project.
+ After specifying an appropriate JSF environment, all the required libraries associated with the selected version will be added to your project.
</para>
<section id="FaceletsSupport865">
@@ -39,7 +39,7 @@
<para>In this section we will focus all the concepts that relate to working with Facelets.</para>
<para>
- Facelets extend JavaServer Faces by providing a lightweight framework that radically simplifies the design of presentation pages for JSF. Facelets can be used in a variety of ways that we will consider further in this section.
+ Facelets extend JavaServer Faces by providing a lightweight framework that radically simplifies the design of JSF presentation pages. Facelets can be used in a variety of ways that we will consider further in this section.
</para>
<section>
13 years, 8 months
JBoss Tools SVN: r29696 - branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-10 19:13:55 -0500 (Thu, 10 Mar 2011)
New Revision: 29696
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/TilesCompoundEditor.java
Log:
JBIDE-8316
https://issues.jboss.org/browse/JBIDE-8316
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/TilesCompoundEditor.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/TilesCompoundEditor.java 2011-03-10 23:44:15 UTC (rev 29695)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/TilesCompoundEditor.java 2011-03-11 00:13:55 UTC (rev 29696)
@@ -63,7 +63,7 @@
protected void createGuiPage() {
guiEditor = new TilesGuiEditor();
try {
- int index = addPage(guiEditor, guiEditor.getEditorInput());
+ int index = addPage(guiEditor, getEditorInput());
setPageText(index, WebUIMessages.DIAGRAM);
guiEditor.setInput(input);
selectionProvider.setHost(guiEditor.getSelectionProvider());
13 years, 8 months
JBoss Tools SVN: r29695 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 18:44:15 -0500 (Thu, 10 Mar 2011)
New Revision: 29695
Removed:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/Manager.java
Log:
even more runtime preferences stuf
- page is working
- initialization is working
(second trial)
Deleted: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/Manager.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/Manager.java 2011-03-10 23:42:05 UTC (rev 29694)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/Manager.java 2011-03-10 23:44:15 UTC (rev 29695)
@@ -1,194 +0,0 @@
-package org.jboss.tools.seam.forge.runtime;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.osgi.framework.Bundle;
-
-public class Manager implements IDebugEventSetListener {
-
- public static final Manager INSTANCE = new Manager();
- public static final String STATE_NOT_RUNNING = "org.jboss.tools.seam.forge.notRunning";
- public static final String STATE_RUNNING = "org.jboss.tools.seam.forge.running";
- public static final String STATE_STARTING = "org.jboss.tools.seam.forge.starting";
- public static final String STATE_STOPPING = "org.jboss.tools.seam.forge.stopping";
-
- private IProcess forgeProcess = null;
- private String runtimeState = STATE_NOT_RUNNING;
- private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
-
- private Manager() {}
-
- public boolean isForgeRunning() {
- return forgeProcess != null && !forgeProcess.isTerminated();
- }
-
- public void startForge() {
- try {
- if (!isForgeRunning()) {
- setRuntimeState(STATE_STARTING);
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
- ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type);
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration = configurations[i];
- if (configuration.getName().equals("Seam Forge")) {
- configuration.delete();
- break;
- }
- }
- ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "Seam Forge");
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.jboss.seam.forge.shell.Bootstrap");
- List<String> classpath = new ArrayList<String>();
- Bundle bundle = Platform.getBundle("org.jboss.tools.seam.forge");
- File file = null;
- try {
- file = FileLocator.getBundleFile(bundle);
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- if (file == null) return;
- File[] children = file.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith("lib");
- }
- });
- if (children.length != 1) return;
- File forgeLibDir = children[0];
-
- File[] forgeLibFiles = forgeLibDir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith("jar");
- }
- });
- for (File libFile: forgeLibFiles) {
- IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(libFile.getAbsolutePath()));
- entry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
- classpath.add(entry.getMemento());
- }
- IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER);
- IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
- systemLibsPath,
- IRuntimeClasspathEntry.STANDARD_CLASSES);
- classpath.add(systemLibsEntry.getMemento());
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IPath path = root.getLocation();
- File workingDir = path.toFile();
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir.getAbsolutePath());
-// workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dseam.forge.shell.colorEnabled=true");
- ILaunchConfiguration configuration = workingCopy.doSave();
- ILaunch launch = configuration.launch(ILaunchManager.RUN_MODE, null, false, false);
- IProcess[] processes = launch.getProcesses();
- if (processes.length == 1) {
- forgeProcess = processes[0];
- }
- DebugPlugin.getDefault().addDebugEventListener(this);
- setRuntimeState(STATE_RUNNING);
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- public void stopForge() {
- if (isForgeRunning()) {
- setRuntimeState(STATE_STOPPING);
- try {
- forgeProcess.terminate();
- } catch (DebugException e) {
- e.printStackTrace();
- }
- setRuntimeState(STATE_NOT_RUNNING);
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
- }
-
- public void setRuntimeState(String newRuntimeState) {
- String oldRuntimeState = this.runtimeState;
- this.runtimeState = newRuntimeState;
- propertyChangeSupport.firePropertyChange(
- new PropertyChangeEvent(
- this,
- "runtimeState",
- oldRuntimeState,
- newRuntimeState));
- }
-
- public String getRuntimeState() {
- return runtimeState;
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertyChangeSupport.addPropertyChangeListener("runtimeState", listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- propertyChangeSupport.removePropertyChangeListener("runtimeState", listener);
- }
-
- protected void finalize() throws Throwable {
- if (forgeProcess != null) {
- if (!forgeProcess.isTerminated()) {
- forgeProcess.terminate();
- }
- forgeProcess = null;
- }
- super.finalize();
- }
-
- public IProcess getProcess() {
- return forgeProcess;
- }
-
- @Override
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource().equals(getProcess())) {
- if (event.getKind() == DebugEvent.TERMINATE) {
- if (forgeProcess.isTerminated()) {
- DebugPlugin.getDefault().asyncExec(new Runnable() {
- public void run() {
- setRuntimeState(STATE_NOT_RUNNING);
- }
- });
- }
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
- }
- }
- }
-
-}
13 years, 8 months
JBoss Tools SVN: r29694 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 18:42:05 -0500 (Thu, 10 Mar 2011)
New Revision: 29694
Added:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences/ForgeIntallationLabelProvider.java
Log:
even more runtime preferences stuf
- page is working
- initialization is working
(second trial)
Added: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences/ForgeIntallationLabelProvider.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences/ForgeIntallationLabelProvider.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences/ForgeIntallationLabelProvider.java 2011-03-10 23:42:05 UTC (rev 29694)
@@ -0,0 +1,27 @@
+package org.jboss.tools.seam.forge.preferences;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.seam.forge.launching.ForgeInstallation;
+
+public class ForgeIntallationLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof ForgeInstallation) {
+ ForgeInstallation forgeInstallation= (ForgeInstallation)element;
+ switch(columnIndex) {
+ case 0:
+ return forgeInstallation.getName();
+ case 1:
+ return forgeInstallation.getLocation();
+ }
+ }
+ return element.toString();
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+}
Property changes on: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/preferences/ForgeIntallationLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 8 months
JBoss Tools SVN: r29693 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 18:40:19 -0500 (Thu, 10 Mar 2011)
New Revision: 29693
Added:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/ForgeRuntime.java
Log:
even more runtime preferences stuf
- page is working
- initialization is working
(second trial)
Added: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/ForgeRuntime.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/ForgeRuntime.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/ForgeRuntime.java 2011-03-10 23:40:19 UTC (rev 29693)
@@ -0,0 +1,346 @@
+package org.jboss.tools.seam.forge.launching;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.jboss.tools.seam.forge.ForgePlugin;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class ForgeRuntime implements IDebugEventSetListener {
+
+ private static final String PREF_FORGE_INSTALLATIONS = "installations";
+
+ private static List<ForgeInstallation> installations = null;
+ private static ForgeInstallation defaultInstallation = null;
+
+ public static ForgeInstallation[] getInstallations() {
+ if (installations == null) {
+ initializeInstallations();
+ }
+ return (ForgeInstallation[])installations.toArray(new ForgeInstallation[installations.size()]);
+ }
+
+ public static ForgeInstallation getDefaultInstallation() {
+ if (installations == null) {
+ initializeInstallations();
+ }
+ return defaultInstallation;
+ }
+
+ private static void initializeInstallations() {
+ String installPrefsXml = ForgePlugin.getDefault().getPreferenceStore().getString(PREF_FORGE_INSTALLATIONS);
+ if (installPrefsXml == null || "".equals(installPrefsXml)) {
+ installPrefsXml = createDefaultInstallationsPreferences();
+ }
+ initializeFromXml(installPrefsXml);
+ }
+
+ private static void initializeFromXml(String installPrefsXml) {
+ if (installPrefsXml == null) return;
+ DocumentBuilder documentBuilder = newDocumentBuilder();
+ if (documentBuilder == null) return;
+ InputStream inputStream = createInputStream(installPrefsXml);
+ if (inputStream == null) return;
+ installations = new ArrayList<ForgeInstallation>();
+ Document document = parseInstallations(documentBuilder, inputStream);
+ Element installationsElement = document.getDocumentElement();
+ String defaultInstallationName = installationsElement.getAttribute("default");
+ NodeList nodeList = installationsElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element)node;
+ String name = element.getAttribute("name");
+ String location = element.getAttribute("location");
+ ForgeInstallation newInstallation = new ForgeInstallation(name, location);
+ installations.add(newInstallation);
+ if (name.equals(defaultInstallationName)) {
+ defaultInstallation = newInstallation;
+ }
+ }
+ }
+ }
+
+ private static Document parseInstallations(DocumentBuilder documentBuilder, InputStream inputStream) {
+ Document result = null;
+ try {
+ result = documentBuilder.parse(inputStream);
+ } catch (SAXException e) {
+ ForgePlugin.log(e);
+ } catch (IOException e) {
+ ForgePlugin.log(e);
+ }
+ return result;
+ }
+
+ private static InputStream createInputStream(String string) {
+ InputStream result = null;
+ try {
+ result = new BufferedInputStream(new ByteArrayInputStream(string.getBytes("UTF8")));
+ } catch (UnsupportedEncodingException e) {
+ ForgePlugin.log(e);
+ }
+ return result;
+ }
+
+ private static DocumentBuilder newDocumentBuilder() {
+ try {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ ForgePlugin.log(e);
+ return null;
+ }
+ }
+
+ private static Document createEmptyDocument() {
+ DocumentBuilder documentBuilder = newDocumentBuilder();
+ if (documentBuilder == null) {
+ return null;
+ } else {
+ return documentBuilder.newDocument();
+ }
+ }
+
+ private static String serializeDocument(Document doc) throws TransformerException, IOException {
+ ByteArrayOutputStream s = new ByteArrayOutputStream();
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer transformer = factory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ DOMSource source = new DOMSource(doc);
+ StreamResult outputTarget = new StreamResult(s);
+ transformer.transform(source, outputTarget);
+ return s.toString("UTF8");
+ }
+
+ private static Document createDefaultInstallationsDocument() {
+ Document document = createEmptyDocument();
+ if (document == null) return null;
+ Element main = document.createElement("forgeInstallations");
+ document.appendChild(main);
+ String defaultLocation = ForgePlugin.getDefault().getBundle().getLocation();
+ defaultLocation = defaultLocation.substring(15);
+ Element defaultInstallation = document.createElement("installation");
+ defaultInstallation.setAttribute("name", "embedded");
+ defaultInstallation.setAttribute("location", defaultLocation);
+ main.appendChild(defaultInstallation);
+ main.setAttribute("default", "embedded");
+ return document;
+ }
+
+ private static String createDefaultInstallationsPreferences() {
+ String result = null;
+ Document document = createDefaultInstallationsDocument();
+ try {
+ result = serializeDocument(document);
+ } catch (Exception e) {
+ ForgePlugin.log(e);
+ }
+ return result;
+ }
+
+ public static final ForgeRuntime INSTANCE = new ForgeRuntime();
+ public static final String STATE_NOT_RUNNING = "org.jboss.tools.seam.forge.notRunning";
+ public static final String STATE_RUNNING = "org.jboss.tools.seam.forge.running";
+ public static final String STATE_STARTING = "org.jboss.tools.seam.forge.starting";
+ public static final String STATE_STOPPING = "org.jboss.tools.seam.forge.stopping";
+
+ private IProcess forgeProcess = null;
+ private String runtimeState = STATE_NOT_RUNNING;
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
+
+ private ForgeRuntime() {}
+
+ public boolean isForgeRunning() {
+ return forgeProcess != null && !forgeProcess.isTerminated();
+ }
+
+ public void startForge() {
+ try {
+ if (!isForgeRunning()) {
+ setRuntimeState(STATE_STARTING);
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
+ ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type);
+ for (int i = 0; i < configurations.length; i++) {
+ ILaunchConfiguration configuration = configurations[i];
+ if (configuration.getName().equals("Seam Forge")) {
+ configuration.delete();
+ break;
+ }
+ }
+ ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "Seam Forge");
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.jboss.seam.forge.shell.Bootstrap");
+ List<String> classpath = new ArrayList<String>();
+ Bundle bundle = Platform.getBundle("org.jboss.tools.seam.forge");
+ File file = null;
+ try {
+ file = FileLocator.getBundleFile(bundle);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ if (file == null) return;
+ File[] children = file.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.endsWith("lib");
+ }
+ });
+ if (children.length != 1) return;
+ File forgeLibDir = children[0];
+
+ File[] forgeLibFiles = forgeLibDir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.endsWith("jar");
+ }
+ });
+ for (File libFile: forgeLibFiles) {
+ IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(libFile.getAbsolutePath()));
+ entry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
+ classpath.add(entry.getMemento());
+ }
+ IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER);
+ IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
+ systemLibsPath,
+ IRuntimeClasspathEntry.STANDARD_CLASSES);
+ classpath.add(systemLibsEntry.getMemento());
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IPath path = root.getLocation();
+ File workingDir = path.toFile();
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir.getAbsolutePath());
+// workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dseam.forge.shell.colorEnabled=true");
+ ILaunchConfiguration configuration = workingCopy.doSave();
+ ILaunch launch = configuration.launch(ILaunchManager.RUN_MODE, null, false, false);
+ IProcess[] processes = launch.getProcesses();
+ if (processes.length == 1) {
+ forgeProcess = processes[0];
+ }
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ setRuntimeState(STATE_RUNNING);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void stopForge() {
+ if (isForgeRunning()) {
+ setRuntimeState(STATE_STOPPING);
+ try {
+ forgeProcess.terminate();
+ } catch (DebugException e) {
+ e.printStackTrace();
+ }
+ setRuntimeState(STATE_NOT_RUNNING);
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+ }
+
+ public void setRuntimeState(String newRuntimeState) {
+ String oldRuntimeState = this.runtimeState;
+ this.runtimeState = newRuntimeState;
+ propertyChangeSupport.firePropertyChange(
+ new PropertyChangeEvent(
+ this,
+ "runtimeState",
+ oldRuntimeState,
+ newRuntimeState));
+ }
+
+ public String getRuntimeState() {
+ return runtimeState;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener("runtimeState", listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener("runtimeState", listener);
+ }
+
+ protected void finalize() throws Throwable {
+ if (forgeProcess != null) {
+ if (!forgeProcess.isTerminated()) {
+ forgeProcess.terminate();
+ }
+ forgeProcess = null;
+ }
+ super.finalize();
+ }
+
+ public IProcess getProcess() {
+ return forgeProcess;
+ }
+
+ @Override
+ public void handleDebugEvents(DebugEvent[] events) {
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource().equals(getProcess())) {
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ if (forgeProcess.isTerminated()) {
+ DebugPlugin.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ setRuntimeState(STATE_NOT_RUNNING);
+ }
+ });
+ }
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+ }
+ }
+ }
+
+}
Property changes on: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/launching/ForgeRuntime.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 8 months
JBoss Tools SVN: r29691 - trunk/forge/plugins/org.jboss.tools.seam.forge.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 18:09:09 -0500 (Thu, 10 Mar 2011)
New Revision: 29691
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/plugin.xml
Log:
even more runtime preferences stuf
- page is working
- initialization is working
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/plugin.xml
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/plugin.xml 2011-03-10 23:08:57 UTC (rev 29690)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/plugin.xml 2011-03-10 23:09:09 UTC (rev 29691)
@@ -53,7 +53,7 @@
<page
name="Installed Forge Runtimes"
category="org.jboss.tools.seam.forge"
- class="org.jboss.tools.seam.forge.preferences.ForgeRuntimesPreferencePage"
+ class="org.jboss.tools.seam.forge.preferences.ForgeInstallationsPreferencePage"
id="org.jboss.tools.seam.forge.runtimes">
</page>
</extension>
13 years, 8 months
JBoss Tools SVN: r29690 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-03-10 18:08:57 -0500 (Thu, 10 Mar 2011)
New Revision: 29690
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleView.java
Log:
even more runtime preferences stuf
- page is working
- initialization is working
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleView.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleView.java 2011-03-10 23:08:45 UTC (rev 29689)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleView.java 2011-03-10 23:08:57 UTC (rev 29690)
@@ -13,7 +13,7 @@
import org.eclipse.ui.part.PageSite;
import org.eclipse.ui.part.ViewPart;
import org.jboss.tools.seam.forge.console.Console;
-import org.jboss.tools.seam.forge.runtime.Manager;
+import org.jboss.tools.seam.forge.launching.ForgeRuntime;
public class ConsoleView extends ViewPart implements PropertyChangeListener {
@@ -29,7 +29,7 @@
public ConsoleView() {
if (INSTANCE == null) {
INSTANCE = this;
- Manager.INSTANCE.addPropertyChangeListener(this);
+ ForgeRuntime.INSTANCE.addPropertyChangeListener(this);
}
}
@@ -80,14 +80,14 @@
}
private void showAppropriatePage() {
- String runtimeState = Manager.INSTANCE.getRuntimeState();
- if (Manager.STATE_NOT_RUNNING.equals(runtimeState)) {
+ String runtimeState = ForgeRuntime.INSTANCE.getRuntimeState();
+ if (ForgeRuntime.STATE_NOT_RUNNING.equals(runtimeState)) {
pageBook.showPage(notRunning);
- } else if (Manager.STATE_RUNNING.equals(runtimeState)) {
+ } else if (ForgeRuntime.STATE_RUNNING.equals(runtimeState)) {
showForgeIsRunning();
- } else if (Manager.STATE_STARTING.equals(runtimeState)) {
+ } else if (ForgeRuntime.STATE_STARTING.equals(runtimeState)) {
pageBook.showPage(waitWhileForgeIsStarting);
- } else if (Manager.STATE_STOPPING.equals(runtimeState)) {
+ } else if (ForgeRuntime.STATE_STOPPING.equals(runtimeState)) {
pageBook.showPage(forgeIsStopping);
}
}
@@ -114,7 +114,7 @@
}
public void dispose() {
- Manager.INSTANCE.removePropertyChangeListener(this);
+ ForgeRuntime.INSTANCE.removePropertyChangeListener(this);
super.dispose();
}
13 years, 8 months