[Title] Advanced Declaration View for HTML Editor
authorhyukmin kwon <hyukmin0530.kwon@samsung.com>
Wed, 5 Jun 2013 02:59:28 +0000 (11:59 +0900)
committerhyukmin kwon <hyukmin0530.kwon@samsung.com>
Wed, 5 Jun 2013 02:59:28 +0000 (11:59 +0900)
[Desc.] Line Number is disabled for non entire file displaying cases.
[Issue] REDMINE-9557

org.tizen.web.advanceddeclarationview/src/org/tizen/web/advanceddeclarationview/ui/HTMLDeclarationPage.java

index 9d14f72..550f7e4 100644 (file)
@@ -1585,12 +1585,12 @@ IMenuListener, IPropertyChangeListener{
        @Override
        public void updateLineNumberRuler(boolean showLineNumber)
        {
-               if (fSrcViewers[mode] !=null) {
+               if ((fSrcViewers[mode] !=null) && modeWithLineNumberRuler(mode)) {
                        if (lineNumberColumnOn != showLineNumber) {
                                if(!showLineNumber){
                                        if(fLineNumberColumns[mode] != null){
                                                for (int i=0; i < NUMBER_OF_MODES; i++) {
-                                                       if (fSrcViewers[i] !=null) {
+                                                       if ((fSrcViewers[i] !=null) && modeWithLineNumberRuler(i)) {
                                                                fVerticalRulers[i].removeDecorator(fLineNumberColumns[i]);
                                                        }
                                                }
@@ -1598,7 +1598,7 @@ IMenuListener, IPropertyChangeListener{
                                } else {
                                        if(fLineNumberColumns[mode] == null){
                                                for (int i=0; i < NUMBER_OF_MODES; i++) {
-                                                       if (fSrcViewers[i] !=null) {
+                                                       if ((fSrcViewers[i] !=null) && modeWithLineNumberRuler(i)) {
                                                                fLineNumberColumns[i] = new LineNumberRulerColumn();
                                                        }
                                                }
@@ -1606,7 +1606,7 @@ IMenuListener, IPropertyChangeListener{
                                                updateLineNumberColumnPresentation(false);
                                        }
                                        for (int i=0; i < NUMBER_OF_MODES; i++) {
-                                               if (fSrcViewers[i] !=null) {
+                                               if ((fSrcViewers[i] !=null) && modeWithLineNumberRuler(i)) {
                                                        fVerticalRulers[i].addDecorator(0, fLineNumberColumns[i]);
                                                }
                                        }
@@ -1616,6 +1616,35 @@ IMenuListener, IPropertyChangeListener{
                }
        }
        
+       private boolean modeWithLineNumberRuler(int mode) {
+               boolean returnValue = false;
+               switch (mode) {
+                       case  MODE_JS_DECLARATION_HTML:
+                               returnValue = true;
+                               break;
+                       case MODE_CSS_DECLARATION:
+                               returnValue = false;
+                               break;
+                       case MODE_IMAGE_VIEW:
+                               returnValue = false;
+                               break;
+                       case  MODE_JS_FILE_VIEW:
+                               returnValue = true;
+                               break;
+                       case MODE_CSS_FILE_VIEW:
+                               returnValue = true;
+                               break;
+                       case MODE_HTML_FILE_VIEW:
+                               returnValue = true;
+                               break;
+                       case MODE_INVALID_CASE:
+                               returnValue = false;
+                               break;  
+                       default:
+                               break;
+               }
+               return returnValue;
+       }
        private void updateLineNumberColumnPresentation(boolean refresh) {
                if (fLineNumberColumns[mode] == null) {
                        return;
@@ -1627,7 +1656,7 @@ IMenuListener, IPropertyChangeListener{
                ISharedTextColors sharedColors= getSharedColors();
 
                for (int i=0; i < NUMBER_OF_MODES; i++) {
-                       if (fSrcViewers[i] !=null) {
+                       if ((fSrcViewers[i] !=null) && (fLineNumberColumns[i] != null)) {
                                fLineNumberColumns[i].setForeground(sharedColors.getColor(rgb));
                                if (refresh) {
                                        fLineNumberColumns[i].redraw();