Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchong2005-05-17 20:29:19 +0000
committerkchong2005-05-17 20:29:19 +0000
commit81165a05682d092b7fd9cb9b27575506a35ea611 (patch)
treec7aaa983346f13c6b954ac788b774ca27928ce45
parent479a9307b3793450c100108198523f8dab46a183 (diff)
downloadwebtools.webservices-81165a05682d092b7fd9cb9b27575506a35ea611.tar.gz
webtools.webservices-81165a05682d092b7fd9cb9b27575506a35ea611.tar.xz
webtools.webservices-81165a05682d092b7fd9cb9b27575506a35ea611.zip
[95645] WSDL editor is using Eclipse internal APIs
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/WSDLMultiPageEditorPart.java94
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/util/ui/FlatViewUtility.java17
2 files changed, 44 insertions, 67 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/WSDLMultiPageEditorPart.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/WSDLMultiPageEditorPart.java
index 79f5c3809..70f267d6c 100644
--- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/WSDLMultiPageEditorPart.java
+++ b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/WSDLMultiPageEditorPart.java
@@ -14,9 +14,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
-import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -25,6 +25,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextInputListener;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Point;
@@ -50,7 +51,9 @@ import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
import org.eclipse.wst.sse.ui.internal.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.provisional.IXMLPreferenceNames;
+import org.eclipse.wst.xml.ui.internal.Logger;
import org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLEditorMessages;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -301,55 +304,46 @@ public class WSDLMultiPageEditorPart extends MultiPageEditorPart implements IPro
//doSaveAsForStructuredTextMulitPagePart();
}
- private void editorInputIsAcceptable(IEditorInput input) throws PartInitException {
- if (input instanceof IFileEditorInput) {
- // verify that it can be opened
- CoreException[] coreExceptionArray = new CoreException[1];
- if (fileDoesNotExist((IFileEditorInput) input, coreExceptionArray)) {
- // todo use message formatter for {0}
- Throwable coreException = coreExceptionArray[0];
- if (coreException instanceof ResourceException) {
- // I'm assuming this is always 'does not exist'
- // we'll refresh local go mimic behavior of default
- // editor, where the
- // troublesome file is refreshed (and will cause it to
- // 'disappear' from Navigator.
- try {
- ((IFileEditorInput) input).getFile().refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
- }
- catch (CoreException ce) {
- // very unlikely
-// Logger.logException(ce);
- }
- throw new PartInitException(WSDLEditorPlugin.getWSDLString("23concat_EXC_", input.getName())); //$NON-NLS-1$
- //$NON-NLS-1$ = "Resource {0} does not exist."
- }
- else {
- throw new PartInitException(WSDLEditorPlugin.getWSDLString("32concat_EXC_", input.getName())); //$NON-NLS-1$
- //$NON-NLS-1$ = "Editor could not be open on {0}"
- }
- }
- }
- else if (input instanceof IStorageEditorInput) {
- InputStream contents = null;
- try {
- contents = ((IStorageEditorInput) input).getStorage().getContents();
- }
- catch (CoreException noStorageExc) {
- }
- if (contents == null) {
- throw new PartInitException(WSDLEditorPlugin.getWSDLString("32concat_EXC_", input.getName())); //$NON-NLS-1$
- }
- else {
- try {
- contents.close();
- }
- catch (IOException e) {
- }
- }
- }
- }
-
+ private void editorInputIsAcceptable(IEditorInput input) throws PartInitException {
+ if (input instanceof IFileEditorInput) {
+ // verify that it can be opened
+ CoreException[] coreExceptionArray = new CoreException[1];
+ if (fileDoesNotExist((IFileEditorInput) input, coreExceptionArray)) {
+ CoreException coreException = coreExceptionArray[0];
+ if (coreException.getStatus().getCode() == IResourceStatus.FAILED_READ_LOCAL) {
+ // I'm assuming this is always 'does not exist'
+ // we'll refresh local go mimic behavior of default
+ // editor, where the
+ // troublesome file is refreshed (and will cause it to
+ // 'disappear' from Navigator.
+ try {
+ ((IFileEditorInput) input).getFile().refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ // very unlikely
+ Logger.logException(ce);
+ }
+ throw new PartInitException(NLS.bind(XMLEditorMessages.Resource__does_not_exist, (new Object[]{input.getName()})));
+ } else {
+ throw new PartInitException(NLS.bind(XMLEditorMessages.Editor_could_not_be_open, (new Object[]{input.getName()})));
+ }
+ }
+ } else if (input instanceof IStorageEditorInput) {
+ InputStream contents = null;
+ try {
+ contents = ((IStorageEditorInput) input).getStorage().getContents();
+ } catch (CoreException noStorageExc) {
+ }
+ if (contents == null) {
+ throw new PartInitException(NLS.bind(XMLEditorMessages.Editor_could_not_be_open, (new Object[]{input.getName()})));
+ } else {
+ try {
+ contents.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
// void doSaveAsForStructuredTextMulitPagePart() {
// setPageText(getActivePage(), fTextEditor.getTitle());
// setInput(fTextEditor.getEditorInput());
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/util/ui/FlatViewUtility.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/util/ui/FlatViewUtility.java
index a6b666c7b..7efa137b0 100644
--- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/util/ui/FlatViewUtility.java
+++ b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/util/ui/FlatViewUtility.java
@@ -39,11 +39,9 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.internal.misc.Workbook;
import org.eclipse.ui.part.PageBook;
import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin;
import org.eclipse.wst.wsdl.ui.internal.util.flatui.FlatPageHeader;
@@ -270,21 +268,6 @@ public class FlatViewUtility implements PaintListener
return pageBook;
}
- public Workbook createWorkbook(Composite parent, int style)
- {
- Workbook workbook = new Workbook(parent, style | flatStyle);
- TabFolder tabFolder = workbook.getTabFolder();
- tabFolder.setBackground(backgroundColor);
-// TODO 3.0: Port
-// PageBook pageBook = workbook.getPageBook();
-// setColor(pageBook);
-// if (flatStyle == SWT.FLAT)
-// {
-// pageBook.addPaintListener(new BorderPainter());
-// }
- return workbook;
- }
-
public Label createHeadingLabel(Composite parent, String text, Color bg) {
return createHeadingLabel(parent, text, bg, SWT.NONE);
}

Back to the top