Author: dgolovin
Date: 2007-09-10 14:54:22 -0400 (Mon, 10 Sep 2007)
New Revision: 3508
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/ModelElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/AttributeSorter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPContentOutlineConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ui/action/JSPFormatter.java
Log:
fixes for :
http://jira.jboss.org/jira/browse/JBIDE-759
http://jira.jboss.org/jira/browse/JBIDE-351
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/ModelElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/ModelElement.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/ModelElement.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -71,8 +71,8 @@
return name;
}
- public static int EQUAL_VALUES = 0;
- public static int NOT_EQUAL_VALUES = Integer.MAX_VALUE;
+ public static final int EQUAL_VALUES = 0;
+ public static final int NOT_EQUAL_VALUES = Integer.MAX_VALUE;
/**
* Returns value of this element for comparison with other value. See compareValue().
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -188,13 +188,9 @@
cleanActionBarStatus();
actionBars.updateActionBars();
}
+ fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ fToggleOccurencesMarkUp.update();
- try {
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
- fToggleOccurencesMarkUp.update();
- } catch (Exception x) {
- }
-
updateStatus();
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
@@ -174,10 +175,11 @@
private void saveSelectedTab() {
IFile file = getFile();
+ String q = "" + selectedPageIndex;
try {
- String q = "" + selectedPageIndex;
file.setPersistentProperty(persistentTabQualifiedName, q);
- } catch (Exception e) {
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logWarning(e);
}
}
@@ -251,12 +253,13 @@
}
private void updateFile() {
- IFile file = getFile();
- if (file != null)
- try {
- file.refreshLocal(0, null);
- } catch (Exception e) {
- }
+ try {
+ IFile file = getFile();
+ if (file != null)
+ file.refreshLocal(0, null);
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logWarning(e);
+ }
}
private IFile getFile() {
@@ -377,11 +380,8 @@
// switchOutlineToJSPEditor();
}
loadSelectedTab();
- try {
- setActivePage(selectedPageIndex);
- pageChange(selectedPageIndex);
- } catch (Exception e) {
- }
+ setActivePage(selectedPageIndex);
+ pageChange(selectedPageIndex);
new ResourceChangeListener(this, getContainer());
if (getModelObject() != null) {
@@ -454,12 +454,12 @@
sourceEditor.addPropertyListener(pcl);
sourceEditor.doSaveAs();
sourceEditor.removePropertyListener(pcl);
- if (old.isModified())
- try {
+ try {
+ if (old.isModified())
new DiscardFileHandler().executeHandler(old, new Properties());
- } catch (Exception e) {
-
- }
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
}
public void gotoMarker(final IMarker marker) {
@@ -467,8 +467,9 @@
pageChange(sourceIndex);
IGotoMarker adapter = (IGotoMarker) sourceEditor
.getAdapter(IGotoMarker.class);
- if (adapter != null)
+ if (adapter != null) {
adapter.gotoMarker(marker);
+ }
}
public boolean isSaveAsAllowed() {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -271,7 +271,6 @@
dropTarget.addDropListener(new DropTargetAdapter() {
private FreeCaretStyledText getFreeCaretControl(
Object sourceOrTarget) {
- try {
if (sourceOrTarget == null)
return null;
@@ -288,8 +287,6 @@
if (control instanceof FreeCaretStyledText)
return (FreeCaretStyledText) control;
- } catch (Exception x) {
- }
return null;
}
@@ -322,45 +319,26 @@
}
public void dragEnter(DropTargetEvent event) {
- try {
- getFreeCaretControl(event.widget).enableFreeCaret(
- true);
- } catch (Exception x) {
- }
+ getFreeCaretControl(event.widget).enableFreeCaret(true);
}
public void dragLeave(DropTargetEvent event) {
- try {
- getFreeCaretControl(event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- }
+ getFreeCaretControl(event.widget).enableFreeCaret(false);
}
public void dragOperationChanged(DropTargetEvent event) {
- try {
- getFreeCaretControl(event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- }
+ getFreeCaretControl(event.widget).enableFreeCaret(false);
}
public void dragOver(DropTargetEvent event) {
- try {
- FreeCaretStyledText fcst = getFreeCaretControl(event.widget);
- int pos = getPosition(fcst, event.x, event.y);
- Point p = fcst.getLocationAtOffset(pos);
- fcst.myRedraw(p.x, p.y);
- } catch (Exception x) {
- }
+ FreeCaretStyledText fcst = getFreeCaretControl(event.widget);
+ int pos = getPosition(fcst, event.x, event.y);
+ Point p = fcst.getLocationAtOffset(pos);
+ fcst.myRedraw(p.x, p.y);
}
public void drop(DropTargetEvent event) {
- try {
- getFreeCaretControl(event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- }
+ getFreeCaretControl(event.widget).enableFreeCaret(false);
}
});
}
@@ -383,17 +361,18 @@
class TextFocusListener extends FocusAdapter {
public void focusLost(FocusEvent e) {
- if (!JSPTextEditor.super.isDirty())
- return;
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- Thread.sleep(200);
- } catch (Exception exc) {
+ if (JSPTextEditor.super.isDirty()) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException exc) {
+ JspEditorPlugin.getPluginLog().logError(exc);
+ }
+ save();
}
- save();
- }
- });
+ });
+ }
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/AttributeSorter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/AttributeSorter.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/AttributeSorter.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -28,7 +28,7 @@
}
public void setWeight(String displayName, int weight) {
- weights.put(displayName, new Integer(weight));
+ weights.put(displayName, Integer.valueOf(weight));
}
public int getWeight(String displayName) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPContentOutlineConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPContentOutlineConfiguration.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPContentOutlineConfiguration.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -271,7 +271,7 @@
public Object getProperty(String propertyName) {
if (propertyName.equals(HTMLCMProperties.IS_XHTML))
- return new Boolean(false);
+ return Boolean.FALSE;
return null;
}
@@ -342,9 +342,9 @@
public Object getProperty(String propertyName) {
if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
- return new Boolean(true);
+ return Boolean.TRUE;
else if (propertyName.equals(HTMLCMProperties.IS_SCRIPTABLE)) {
- return getAttrType().getDataTypeName() == HTMLCMDataType.SCRIPT ? new Boolean(true) :
new Boolean(false);
+ return getAttrType().getDataTypeName() == HTMLCMDataType.SCRIPT ? Boolean.TRUE :
Boolean.FALSE;
}
return super.getProperty(propertyName);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -56,7 +56,7 @@
public class JSPPropertySourceAdapter implements INodeAdapter, IPropertySource,
IPropertySourceExtension, IPropertySource2 {//extends XMLPropertySourceAdapter {
protected final static String CATEGORY_ATTRIBUTES =
XMLUIMessages.XMLPropertySourceAdapter_0;
- private static final boolean fSetExpertFilter = false;
+ private static final boolean SET_EXPERT_FILTER = false;
AttributeSorter sorter = null;
private Node fNode = null;
@@ -291,7 +291,7 @@
TextPropertyDescriptor descriptor = new TextPropertyDescriptor(attributeName,
attributeName);
descriptor.setCategory(getCategory(null));
descriptor.setDescription(attributeName);
-// if (hideOnFilter && fSetExpertFilter)
+// if (hideOnFilter && SET_EXPERT_FILTER)
// descriptor.setFilterFlags(new String[]{IPropertySheetEntry.FILTER_ID_EXPERT});
return descriptor;
}
@@ -731,7 +731,7 @@
TextPropertyDescriptor descriptor = new TextPropertyDescriptor(name, name);
descriptor.setCategory(category);
descriptor.setDescription(name);
- if (usage != CMAttributeDeclaration.REQUIRED && fSetExpertFilter)
+ if (usage != CMAttributeDeclaration.REQUIRED && SET_EXPERT_FILTER)
descriptor.setFilterFlags(new String[]{IPropertySheetEntry.FILTER_ID_EXPERT});
return descriptor;
}
@@ -741,7 +741,7 @@
EnumeratedStringPropertyDescriptor descriptor = new
EnumeratedStringPropertyDescriptor(attrDecl.getAttrName(), attrDecl.getAttrName(),
_getValidStrings(attrDecl, valuesHelper));
descriptor.setCategory(getCategory(attrDecl));
descriptor.setDescription(attrDecl.getAttrName());
- if (attrDecl.getUsage() != CMAttributeDeclaration.REQUIRED &&
fSetExpertFilter)
+ if (attrDecl.getUsage() != CMAttributeDeclaration.REQUIRED &&
SET_EXPERT_FILTER)
descriptor.setFilterFlags(new String[]{IPropertySheetEntry.FILTER_ID_EXPERT});
return descriptor;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ui/action/JSPFormatter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ui/action/JSPFormatter.java 2007-09-10
14:50:21 UTC (rev 3507)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ui/action/JSPFormatter.java 2007-09-10
18:54:22 UTC (rev 3508)
@@ -14,12 +14,12 @@
import org.eclipse.jface.text.*;
public class JSPFormatter {
- static int ROOT = 0;
- static int TEXT = 1;
- static int TAG = 2;
- static int TAG_CLOSING = 3;
- static int JSP = 4;
- static int COMMENT = 5;
+ static final int ROOT = 0;
+ static final int TEXT = 1;
+ static final int TAG = 2;
+ static final int TAG_CLOSING = 3;
+ static final int JSP = 4;
+ static final int COMMENT = 5;
String text;
StringBuffer sb = new StringBuffer();