Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2274)

Unified Diff: editor/tools/plugins/com.google.dart.tools.deploy/src/com/google/dart/tools/ui/omni/elements/FileElement.java

Issue 10382207: Searchbox proposal UI facelift to add styled details. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698