Index: editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/elements/FileElement.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/elements/FileElement.java (revision 7702) |
+++ editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/elements/FileElement.java (working copy) |
@@ -1,26 +1,25 @@ |
/* |
- * Copyright (c) 2011, the Dart project authors. |
- * |
- * Licensed under the Eclipse Public License v1.0 (the "License"); you may not |
- * use this file except in compliance with the License. You may obtain a copy of |
- * the License at |
- * |
+ * Copyright (c) 2012, the Dart project authors. |
+ * |
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except |
+ * in compliance with the License. You may obtain a copy of the License at |
+ * |
* http://www.eclipse.org/legal/epl-v10.html |
- * |
- * Unless required by applicable law or agreed to in writing, software |
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
- * License for the specific language governing permissions and limitations under |
+ * |
+ * Unless required by applicable law or agreed to in writing, software distributed under the License |
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
+ * or implied. See the License for the specific language governing permissions and limitations under |
* the License. |
*/ |
package com.google.dart.tools.ui.omni.elements; |
+import com.google.dart.tools.ui.DartElementLabels; |
import com.google.dart.tools.ui.DartToolsPlugin; |
import com.google.dart.tools.ui.omni.OmniBoxImages; |
import com.google.dart.tools.ui.omni.OmniElement; |
-import com.google.dart.tools.ui.omni.OmniProposalProvider; |
import org.eclipse.core.commands.ExecutionException; |
+import org.eclipse.core.resources.IContainer; |
import org.eclipse.core.resources.IFile; |
import org.eclipse.jface.resource.ImageDescriptor; |
import org.eclipse.ui.IWorkbenchPage; |
@@ -39,7 +38,7 @@ |
*/ |
private final IFile file; |
- public FileElement(OmniProposalProvider provider, IFile resource) { |
+ public FileElement(FileProvider provider, IFile resource) { |
super(provider); |
this.file = resource; |
} |
@@ -64,6 +63,24 @@ |
} |
@Override |
+ public String getDetailedLabel() { |
+ StringBuffer result = new StringBuffer(); |
+ result.append(file.getName()); |
+ |
+ //only cache for duplicates |
+ if (isDuplicate()) { |
+ detailOffset = result.length(); |
+ } |
+ |
+ IContainer container = file.getParent(); |
+ if (container != null) { |
+ result.append(DartElementLabels.CONCAT_STRING); |
+ result.append(container.getName()); |
+ } |
+ return result.toString(); |
+ } |
+ |
+ @Override |
public String getId() { |
return file.getName(); |
} |
@@ -75,14 +92,17 @@ |
@Override |
public String getLabel() { |
+ return isDuplicate() ? getDetailedLabel() : getBasicLabel(); |
+ } |
+ |
+ @Override |
+ public FileProvider getProvider() { |
+ return (FileProvider) super.getProvider(); |
+ } |
+ |
+ private String getBasicLabel() { |
StringBuffer result = new StringBuffer(); |
result.append(file.getName()); |
-//TODO (pquitslund): qualification removed from labels |
-// IContainer container = file.getParent(); |
-// if (container != null) { |
-// result.append(DartElementLabels.CONCAT_STRING); |
-// result.append(container.getFullPath().toOSString()); |
-// } |
return result.toString(); |
} |